#include
int main(void)
{
FILE* fp;
char ch;
if( (fp=fopen("a.txt","r")) == NULL )
{
printf("Cannot open the file.\n");
exit(-1);
}
while((ch = fgetc(*fp)) != EOF)
putchar(ch);
fclose(fp);
return 0;
}
gcc rr.c 后来出现下列问题。怎么回事儿???
rr.c: In function ‘main’:
rr.c:22:2: error: incompatible type for argument 1 of ‘fgetc’
while((ch = fgetc(*fp)) != EOF)
^
In file included from rr.c:8:0:
/usr/include/stdio.h:531:12: note: expected ‘struct FILE *’ but argument is of type ‘FILE’
extern int fgetc (FILE *__stream);