通过getc和putc函数进行输入和输出

来源:互联网 发布:黑色素疤痕知乎 编辑:程序博客网 时间:2024/05/29 16:46
#include"stdio.h"
#include"stdlib.h"
main()
{FILE *fpout;
char ch;
if((fpout=fopen("file_a.dat","w"))==NULL)
{printf("Can't open this file!\n");exit(0);}
ch=getchar();
while(ch!='@');
{fputc(ch,fpout);ch=getchar();}
fclose(fpout);
}
输入后为啥文件file_a.dat里字符呢?
原创粉丝点击