#include <stdio.h>
#include <stdlib.h>
#define N 36
int main(void){
char str[N];
char *p;
FILE *fp;
fp = fopen("file.txt","w");//以写的方式打开文件
if(fp==NULL)//打开不成功则退出
{
printf("文件打开失败!\n");
exit(0); //exit()函数定义在stdlib.h中
}
gets(str);
p=str;
while(*p!='#'){
fputc(*p,fp);
p++;
}
fclose(fp); //关闭文件
return 0;
}