diff options
| -rw-r--r-- | csv.c | 2 | ||||
| -rw-r--r-- | csv.h | 16 |
2 files changed, 15 insertions, 3 deletions
| @@ -465,7 +465,7 @@ csv_write_field(FILE *out, const char *field, const csv_options_t * const csv_op | |||
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | void | 467 | void |
| 468 | csv_write(FILE *out, int n, const char *fields[], const csv_options_t * csv_options) | 468 | csv_write_ex(FILE *out, int n, const char *fields[], const csv_options_t * csv_options) |
| 469 | { | 469 | { |
| 470 | assert(out != NULL); | 470 | assert(out != NULL); |
| 471 | assert(fields != NULL); | 471 | assert(fields != NULL); |
| @@ -47,14 +47,26 @@ typedef struct { | |||
| 47 | csv_field_t csv_field; | 47 | csv_field_t csv_field; |
| 48 | } csv_t; | 48 | } csv_t; |
| 49 | 49 | ||
| 50 | /* initialization */ | ||
| 50 | void csv_init(csv_t *csv); | 51 | void csv_init(csv_t *csv); |
| 51 | void csv_init_opt(csv_t *csv, const csv_options_t * const csv_options); | 52 | void csv_init_opt(csv_t *csv, const csv_options_t * const csv_options); |
| 53 | |||
| 54 | /* cleanup after error */ | ||
| 52 | void csv_cleanup(csv_t *csv); | 55 | void csv_cleanup(csv_t *csv); |
| 56 | |||
| 57 | /* read */ | ||
| 58 | int csv_read(csv_t *csv, FILE *in); | ||
| 59 | |||
| 60 | /* field access */ | ||
| 53 | int csv_nfields(csv_t *csv); | 61 | int csv_nfields(csv_t *csv); |
| 54 | const char * csv_field(csv_t *csv, int idx); | 62 | const char * csv_field(csv_t *csv, int idx); |
| 55 | int csv_read(csv_t *csv, FILE *in); | 63 | |
| 64 | /* write */ | ||
| 65 | void csv_write(FILE *out, const csv_t * const csv); | ||
| 66 | void csv_write_ex(FILE *out, int n, const char *fields[], const csv_options_t * const csv_options); | ||
| 67 | |||
| 68 | /* error handling */ | ||
| 56 | const char * csv_err_str(csv_err_t csv_err); | 69 | const char * csv_err_str(csv_err_t csv_err); |
| 57 | void csv_write(FILE *out, int n, const char *fields[], const csv_options_t * const csv_options); | ||
| 58 | 70 | ||
| 59 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
| 60 | } | 72 | } |
