Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __CSV_CONVERTER_H_
- #define __CSV_CONVERTER_H_
- #define CSVC_NUMBER_OF_FIELDS 300
- #define CSVC_NUMBER_OF_CHARACTERS_IN_FIELD 2000
- /*
- * Structure of a record
- *
- * fp -> file pointer to where the catch records
- * index -> current record number
- * length -> number of fields
- * eof -> TRUE if fp came to end
- * fields -> array with values of the fields
- */
- typedef struct {
- FILE* fp;
- int index;
- int length;
- int last_char;
- char fields[CSVC_NUMBER_OF_FIELDS][CSVC_NUMBER_OF_CHARACTERS_IN_FIELD];
- } CSVC_RECORD;
- /*
- * External declaration of the variable global_record defined in c_carmentito.c
- */
- extern CSVC_RECORD csvc_record;
- /*
- * Set the file pointer in global_record
- *
- * fp -> file pointer that will be set in global_record
- *
- * Returns: fp
- */
- FILE* csvc_open_file(char* file_name);
- /*
- * Set NULL to the fp in global_record
- *
- *
- *
- * Returns:
- * what fclose() returns
- */
- int csvc_close_file(void);
- /*
- * Points to next record (after RECORD_SEPARATOR) in fp
- *
- * Returns:
- * if csvc_record.last_char is EOF, returns EOF otherwise it returns RECORD_SEPARATOR
- */
- int csvc_next_record(void);
- /*
- * Read all the record fields and stores in global_record
- *
- * Returns:
- * if csvc_record.last_char is EOF, returns EOF otherwise it returns RECORD_SEPARATOR
- */
- int csvc_load_record(void);
- /*
- * Get value of the field that is in the position field_number at the RECORD struct
- *
- * field_number -> position of the field
- *
- * Returns:
- * value of the field
- */
- char* csvc_field_value(unsigned int field_number);
- /*
- * Get the first non-empty field in the current record starting in field_number at the RECORD struct
- *
- * field_number -> variable that contains the field position
- *
- * Returns:
- * position of the first field non-empty at this record
- */
- int csvc_next_field_nonempty(unsigned int field_number);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment