如果有人可以帮助我完成我的“程序”,那就太好了。我正在尝试读取 csv 文件并将其移动到二维数组。它停在第 17 行(共 200 行)。
int main ()
{
FILE * pFile;
double **tab;
char bufor [100];
int i=0;
tab = (double**)malloc(sizeof(double*));
pFile = fopen ("sygnal1.csv" , "r");
if (pFile == NULL) printf("Error");
else
while (fgets (bufor , 100 , pFile))
{
tab[i] = (double *) malloc(2 * sizeof(double));
sscanf(bufor, "%lf, %lf,", &tab[i][0], &tab[i][1]);
printf("%lf.%lf.\n",tab[i][0],tab[i][1]); //It's here only for testing
i++;
}
printf("number of lines read %d\n",i);
fclose (pFile);
system("PAUSE");
return 0;
}