Comma separated CSV file

Hi,

How can I read comma separated CSV file in root ? The CSV file has first column integer and second column float. I am getting everything zero.

void ex4(){

FILE *input = fopen("/home/kanhaiya/Data/B0_DecayTime.csv", “r”);

int i;
float j;

while (fscanf(input,"%i %f",&i, &j)!=EOF){

 std::cout <<i << std::endl; 
 std::cout <<j << std::endl; 

}

}
Thank you.


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


This has nothing to do with ROOT.

Google -> fscanf read csv file

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.