#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch;
FILE *fp=fopen("D:\\test.txt","w");
if(fp!=NULL)
{
printf("请输入一串字符: ");
ch=getchar();
while(ch!='#')
{
fputc(ch,fp);
ch=getchar();
}
fclose(fp);
}
else
printf("error!\n");
return 0;
}