2024-11-29 10:21:42
程序代码:
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 1024
int main(int argc, char * argv[])
{
FILE *fp;
char buf[MAXSIZE];
fp = fopen("./hanzi.txt","r");
if(fp == NULL)
{
perror("call to fopen!");
exit(1);
}
fread(buf,1,MAXSIZE,fp);
printf("%s\n",buf);
return 0;
}
附 hanzi.txt文件内容:
你好,很高兴认识你!希望你的人生的每一天都会像今夜的星辰一样,灿烂无比!
运行结果截图:
2024-11-29 13:49:50
2024-11-29 14:56:48