Skip to content

SongDanielLi/cCsvReader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);