当这个函数从它的调用中返回时,我似乎无法从中打印任何东西。当我尝试从函数内打印时,它可以正常工作,但在调用后不会打印。不知道该怎么办。
int *sched;
getSchedFile(schFile, sched);
printf("%d\n",sched[1]);
void getSchedFile (FILE *file, int *schd){
/* Get the number of bytes */
fseek(file, 0L, SEEK_END);
int bytes = ftell(file);
fseek(file, 0L, SEEK_SET);
schd = malloc(bytes * sizeof(int));
int pos = 0, curDigit;
while((fscanf(file, "%d", &curDigit)) != EOF){
schd[pos]=curDigit;
++pos;
}
}