我只是想读取文件的每个字符并将其打印出来,但是当文件完成阅读时,但我得到了一堆?完成阅读后.我如何解决它?
#include <stdio.h> int main(void){ FILE *fr; /* declare the file pointer */ fr = fopen ("some.txt","r"); /* open the file for reading */ /* elapsed.dta is the name of the file */ /* "rt" means open the file for reading text */ char c; while((c = getc(fr)) != NULL) { printf("%c",c); } fclose(fr); /* close the file prior to exiting the routine */ /*of main*/ return 0; }