Easy-to-use CSV parsing library for C language.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 lines
1.0 KiB

#include "../include/easycsv/easycsv.h"
int main(void)
{
const char CSV_FP[] = "02.csv";
struct easycsv *csv = easycsv_init(CSV_FP, EASYCSV_W);
if (csv == NULL) {
fprintf(stderr, "Failed to load %s\n", CSV_FP);
return -1;
}
const char mod_one[] = "first-mod-deluxe-edition";
const char *paths_one[5] = {
"FILEPATH1ONE",
"FILEPATH2ONE",
"FILEPATH3ONE",
"FILEPATH4ONE",
"FILEPATH5ONE"
};
const char mod_two[] = "second-mod-gold-edition";
const char *paths_two[4] = {
"FILEPATH1TWO",
"FILEPATH2TWO",
"FILEPATH3TWO",
"FILEPATH4TWO"
};
if (easycsv_pushcolumn(csv, mod_one) < 0) {
return -1;
}
for (size_t st = 0; st < 5; st++) {
if (easycsv_pushcolumnvalue(csv, mod_one, paths_one[st]) < 0) return -1;
}
if (easycsv_pushcolumn(csv, mod_two) < 0) {
return -1;
}
for (size_t st = 0; st < 4; st++) {
if (easycsv_pushcolumnvalue(csv, mod_two, paths_two[st]) < 0) return -1;
}
easycsv_free(csv);
csv = NULL;
return 0;
}