reading csv file with fscanf
Hi,
I have a csv file containing numbers like
0.2, 11.2, 2.3, 3.01, ....
12.1, 10.5, 12.3, ...
7.2, 56.1, .......
I'd like to put these numbers into an array, but it fails. Here is my code,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
float container[3][36] = {};
FILE *f;
f = fopen("file.csv", "r");
int i, j;
float temp;
for (i = 0; i<3; i++)
for (j = 0; j<36; j++)
{
fscanf(f, "%f",&temp);
container[i][j] = temp;
}
|
Thank you!
Topic archived. No new replies allowed.