fix strsep

This commit is contained in:
Aurélien Gauthier 2022-06-24 17:22:33 +02:00
parent b464ff1541
commit fecd2124d7

View file

@ -31,20 +31,20 @@ void fillArrayWithRawData(char *rawDataFileName, long **p, int N, int M)
char *buffer;
size_t bufsize = 200;
buffer = (char *)malloc(bufsize * sizeof(char));
char * token;
char *token;
FILE *f = fopen(rawDataFileName, "r");
for (i = 0; i < N; i++)
{
char *t , *c1, *c2 , *c3;
while (fscanf(f , "%s,%s,%s,%s\n",t,c1,c2,c3))
long t, c1, c2, c3;
while (fscanf(f, "%ld,%ld,%ld,%ld\n", &t, &c1, &c2, &c3))
{ // séparation valeur par virgule initiale : csv
printf("%s,%s,%s,%s",t,c1,c2,c3);
p[i][0] = atol(t);
p[i][1] = atol(c1);
p[i][2] = atol(c2);
p[i][3] = atol(c3);
printf("%ld,%ld,%ld,%ld\n", t, c1, c2, c3);
p[i][0] = t;
p[i][1] = c1;
p[i][2] = c2;
p[i][3] = c3;
}
}
fclose(f);