📄 file_eof.c
字号:
// file_eof.c --open a file and display it
#include <stdio.h>
#include <stdlib.h> // for exit()
int main()
{
int ch;
FILE * fp;
char fname[50]; // to hold the file name
printf("Enter the name of the file: ");
scanf("%s", fname);
fp = fopen(fname, "r"); // open file for reading
if (fp == NULL) // attempt failed
{
printf("Failed to open file. Bye\n");
exit(1); // quit program
}
// getc(fp) gets a character from the open file
while ((ch = getc(fp)) != EOF)
putchar(ch);
fclose(fp); // close the file
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -