SongDanielLi / cCsvReader

read csv file with header in c.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSV Reader

read csv file with header in c.

  • csv file format:
    • delimeter: ","
    • first row is header text, and the remaining rows are all digit.

Usage

read line-by-line

CSVFILE file;
if(csvOpen(&file, "./sample.csv")){
    while(csvReadLine(&file)){
        printf("field c: %lf\n", file.GetField(&file, "c"));
    }
}

read with callback

void onCsvUpdate(CSVFILE *file){
    printf("field m: %lf\n", file->GetField(file, "m"));
}

csvReadCallback("./sample.csv", onCsvUpdate);

About

read csv file with header in c.

License:MIT License


Languages

Language:C 89.4%Language:Makefile 10.6%