char * csv_write_string(const CSVRow *row, char delimiter)
Converts a CSVRow structure into a single formatted string.
CSVRow * csv_row_create(int field_count, const char **fields)
Manually creates and allocates a CSVRow structure from an array of strings.
Definition libcsv.c:106
CSVRow * csv_parse_string(const char *csv_string, char delimiter)
Parses an individual CSV-formatted string into a CSVRow structure.
Definition libcsv.c:161
char * csv_get_field(const CSVRow *row, int field_index)
Retrieves the value of a specific field in a row by its index.
Definition libcsv.c:246
char csv_get_delimiter(const CSVParser *parser)
Gets the current delimiter configured for the parser.
Definition libcsv.c:267
CSVError
Error codes returned by library operations.
Definition libcsv.h:9
@ CSV_SUCCESS
Definition libcsv.h:10
@ CSV_ERROR_INVALID_ARG
Definition libcsv.h:13
@ CSV_ERROR_MEMORY
Definition libcsv.h:11
@ CSV_ERROR_FILE_OPEN
Definition libcsv.h:12
void csv_set_delimiter(CSVParser *parser, char new_delimiter)
Updates the delimiter character used by an active parser.
Definition libcsv.c:258
CSVRow * csv_read_row(CSVParser *parser)
Reads the next row from the CSV file using the parser.
Definition libcsv.c:46
void csv_parser_destroy(CSVParser *parser)
Frees resources associated with the parser and closes the open file.
Definition libcsv.c:32
void csv_row_destroy(CSVRow *row)
Frees memory allocated for a CSVRow structure and all its internal fields.
Definition libcsv.c:146
const char * csv_error_message(CSVError error)
Returns a human-readable message corresponding to an error code.
Definition libcsv.c:277
CSVParser * csv_parser_create(const char *filename, char delimiter)
Creates and initializes a parser to read a CSV file.
Definition libcsv.c:11
int csv_write_file(const CSVRow *row, const char *filename, char delimiter)
Writes the contents of a CSVRow directly to a file.
Definition libcsv.c:218
CSVError csv_get_last_error(void)
Gets the last error code produced by the library on the calling thread.
Definition libcsv.c:292
Structure managing the state of a CSV file parser.
Definition libcsv.h:27
char delimiter
Definition libcsv.h:29
FILE * file
Definition libcsv.h:28
Structure representing a single CSV row.
Definition libcsv.h:19
char ** fields
Definition libcsv.h:20
int field_count
Definition libcsv.h:21