csvpp 1.2.0
CSV parsing / writing libraries
|
C CSV library. More...
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include "version.h"
Go to the source code of this file.
Typedefs | |
typedef struct CSV_row | CSV_row |
typedef struct CSV_reader | CSV_reader |
typedef struct CSV_writer | CSV_writer |
Enumerations | |
enum | CSV_status { CSV_OK , CSV_EOF , CSV_PARSE_ERROR , CSV_IO_ERROR , CSV_TOO_MANY_FIELDS_WARNING , CSV_INTERNAL_ERROR } |
Status codes. More... | |
Functions | |
char * | CSV_strdup (const char *src) |
strdup implementation, in case it's not implemented in string.h | |
CSV_row * | CSV_row_init (void) |
Create a new CSV_row. | |
void | CSV_row_free (CSV_row *rec) |
Free a CSV_row. | |
void | CSV_row_append (CSV_row *rec, char *field) |
Append a new field. | |
size_t | CSV_row_size (const CSV_row *rec) |
Get CSV_Record array size. | |
const char * | CSV_row_get (const CSV_row *rec, size_t i) |
CSV_row array element access. | |
CSV_status | CSV_row_read_v (CSV_row *rec,...) |
Reads fields into variadic arguments. | |
const char *const * | CSV_row_arr (const CSV_row *rec) |
CSV_row array access. | |
CSV_reader * | CSV_reader_init_from_filename (const char *filename) |
Create a new CSV_reader object parsing from a file. | |
CSV_reader * | CSV_reader_init_from_file (FILE *file) |
Create a new CSV_reader object parsing from a FILE *. | |
CSV_reader * | CSV_reader_init_from_str (const char *input) |
Create a new CSV_reader object parsing from an in-memory string. | |
void | CSV_reader_free (CSV_reader *reader) |
Free a CSV_reader object. | |
void | CSV_reader_set_delimiter (CSV_reader *reader, const char delimiter) |
Change delimiter character. | |
void | CSV_reader_set_quote (CSV_reader *reader, const char quote) |
Change the quote character. | |
void | CSV_reader_set_lenient (CSV_reader *reader, const bool lenient) |
Enable / disable lenient parsing. | |
char * | CSV_reader_read_field (CSV_reader *reader) |
Read a single field. | |
CSV_status | CSV_reader_read_v (CSV_reader *reader,...) |
Reads fields into variadic arguments. | |
CSV_row * | CSV_reader_read_row (CSV_reader *reader) |
Read the current row from the CSV file and advance to the next. | |
CSV_status | CSV_reader_read_row_ptr (CSV_reader *reader, char ***fields, size_t *num_fields) |
Read a row into an array of strings. | |
bool | CSV_reader_eof (const CSV_reader *reader) |
Check for end of input. | |
bool | CSV_reader_end_of_row (const CSV_reader *reader) |
Check for end of current row. | |
const char * | CSV_reader_get_error_msg (const CSV_reader *reader) |
Get message for last error. | |
CSV_status | CSV_reader_get_error (const CSV_reader *reader) |
Get error code for last error. | |
CSV_writer * | CSV_writer_init_from_filename (const char *filename) |
Create a new CSV_writer object writing to a file. | |
CSV_writer * | CSV_writer_init_from_file (FILE *file) |
Create a new CSV_writer object writing to a FILE *. | |
CSV_writer * | CSV_writer_init_to_str (void) |
Create a new CSV_writer object writing to a string. | |
void | CSV_writer_free (CSV_writer *writer) |
Free a CSV_writer object. | |
void | CSV_writer_set_delimiter (CSV_writer *writer, const char delimiter) |
Change delimiter character. | |
void | CSV_writer_set_quote (CSV_writer *writer, const char quote) |
Change the quote character. | |
CSV_status | CSV_writer_end_row (CSV_writer *writer) |
End the current row. | |
CSV_status | CSV_writer_write_field (CSV_writer *writer, const char *field) |
Write a single field. | |
CSV_status | CSV_writer_write_fields (CSV_writer *writer, const CSV_row *fields) |
Write a CSV_row without ending the current row. | |
CSV_status | CSV_writer_write_fields_ptr (CSV_writer *writer, const char *const *fields, const size_t num_fields) |
Write an array of strings without ending the current row. | |
CSV_status | CSV_writer_write_fields_v (CSV_writer *writer,...) |
Write from the given variadic parameters without ending the current row. | |
CSV_status | CSV_writer_write_row (CSV_writer *writer, const CSV_row *fields) |
Write a CSV_row. | |
CSV_status | CSV_writer_write_row_ptr (CSV_writer *writer, const char *const *fields, const size_t num_fields) |
Write an array of strings as a row. | |
CSV_status | CSV_writer_write_row_v (CSV_writer *writer,...) |
Write a row from the given variadic parameters. | |
const char * | CSV_writer_get_str (CSV_writer *writer) |
Get the string output. | |
C CSV library.