level 8
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
char filename[20],ch;
printf("Please input the filename you want to write:\n");
scanf("%s",filename);
if(!(fp=fopen(filename,"wt+")))
{
printf("Error!!");
exit(0);
}
printf("Please input what you want to write:\n");
ch=getchar();
ch=getchar();
while(ch!=EOF)
{
if(!(fputc(ch,fp)))
{
printf("Input error\n");
}
ch=getchar();
}
fclose(fp);
return 0;
}
2013年12月29日 08点12分
3
非常感谢!我试了一下,真的可以!
2013年12月29日 08点12分