用C语言实现文件读写操作
2023-07-06
#include “stdio.h”
main()
FILE *fp;
char ch,filename[10];
scanf(“%s”,filename);
if((fp=fopen(filename,”w”)==NULL)
printf(“cann’t open file ”);
exit(0);
ch=getchar();
while(ch!=’#\)
fputc(ch,fp);
putchar(ch);
ch=getchar();
fclose(fp);