fix strsep
This commit is contained in:
parent
b464ff1541
commit
fecd2124d7
|
@ -31,20 +31,20 @@ void fillArrayWithRawData(char *rawDataFileName, long **p, int N, int M)
|
||||||
char *buffer;
|
char *buffer;
|
||||||
size_t bufsize = 200;
|
size_t bufsize = 200;
|
||||||
buffer = (char *)malloc(bufsize * sizeof(char));
|
buffer = (char *)malloc(bufsize * sizeof(char));
|
||||||
char * token;
|
char *token;
|
||||||
|
|
||||||
FILE *f = fopen(rawDataFileName, "r");
|
FILE *f = fopen(rawDataFileName, "r");
|
||||||
|
|
||||||
for (i = 0; i < N; i++)
|
for (i = 0; i < N; i++)
|
||||||
{
|
{
|
||||||
char *t , *c1, *c2 , *c3;
|
long t, c1, c2, c3;
|
||||||
while (fscanf(f , "%s,%s,%s,%s\n",t,c1,c2,c3))
|
while (fscanf(f, "%ld,%ld,%ld,%ld\n", &t, &c1, &c2, &c3))
|
||||||
{ // séparation valeur par virgule initiale : csv
|
{ // séparation valeur par virgule initiale : csv
|
||||||
printf("%s,%s,%s,%s",t,c1,c2,c3);
|
printf("%ld,%ld,%ld,%ld\n", t, c1, c2, c3);
|
||||||
p[i][0] = atol(t);
|
p[i][0] = t;
|
||||||
p[i][1] = atol(c1);
|
p[i][1] = c1;
|
||||||
p[i][2] = atol(c2);
|
p[i][2] = c2;
|
||||||
p[i][3] = atol(c3);
|
p[i][3] = c3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Reference in a new issue