#include <stdio.h>
#include <stdlib.h>
void main(){
FILE *fp;
char ch;
if((fp=fopen("E:\\exp01.txt","w"))==NULL){
printf("cannot open file\n");
exit(0);
}
ch=getchar();
while(ch!='#'){
putc(ch,fp);
ch=getchar();
}
fclose(fp);
}
#include <stdio.h>
#include <stdlib.h>
void main(){
FILE *fp;
char ch;
if((fp=fopen("E:\\exp01.txt","w"))==NULL){
printf("cannot open file\n");
exit(0);
}
ch=getchar();
while(ch!='#'){
putc(ch,fp);
ch=getchar();
}
fclose(fp);
}
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。