输出当前文件执行代码,FILE 为当前执行的文件常量。
include
int main() {
FILE *fp;
char c;
fp = fopen(FILE,"r");
do {
c = getc(fp);
putchar(c);
}
while(c != EOF);
fclose(fp);
return 0;
}
输出结果为:
include
int main() {
FILE *fp;
char c;
fp = fopen(FILE,"r");
do {
c = getc(fp);
putchar(c);
}
while(c != EOF);
fclose(fp);
return 0;
}