|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <stdlib.h>
void main()
{
FILE *fp;
char ch, filename[20];
printf("Please input the filename you want to write:");
scanf("%s", filename);
if(!(fp = fopen(filename, "wt")))
{
printf("Cannot open the file!\n");
exit(0);
}
printf("Please input the sensentence you want to write:");
ch = getchar(); //接受回车的符
ch = getchar(); //接受输入的第一个字母
while(ch != EOF)
{
fputc(ch, fp);
ch = getchar();
}
fclose(fp);
}
补充内容 (2012-10-23 16:37):
里面的视频为什么输入两个EOF,很是不解啊! |
|