Open chrisinmtown opened 3 years ago
for anyone wanting to read numerical data from csv, try this:
void field_cb(void *field, size_t field_len, void *data) {
// whatever you need from the above example
char* val = strndup((char*)field, field_len); // this gets only the number of byte just read into field
double v = atof(val); // this converts those bytes into a double
// whatever else you need
}
I think it would really help if the
examples/
area has a program that demonstrates how to get and process CSV data. I offer the following, maybe call it csvdump.c. I believe it frees all resources but please double check, my C skills are a little rusty.