Posted in 面试题 onOctober 27, 2013
#include “stdio.h”
main()
{
FILE *fp;
char ch,filename[10];
scanf(“%s”,filename);
if((fp=fopen(filename,”w”)==NULL)
{
printf(“cann’t open file\n”);
exit(0);
}
ch=getchar();
while(ch!=’#)
{
fputc(ch,fp);
putchar(ch);
ch=getchar();
}
fclose(fp);
}
main()
{
FILE *fp;
char ch,filename[10];
scanf(“%s”,filename);
if((fp=fopen(filename,”w”)==NULL)
{
printf(“cann’t open file\n”);
exit(0);
}
ch=getchar();
while(ch!=’#)
{
fputc(ch,fp);
putchar(ch);
ch=getchar();
}
fclose(fp);
}
用C语言实现文件读写操作
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@