对于以下程序,说法正确的是( )。 #include <stdio.h> main() { FILE *fp; fp=fopen("quiz.txt", "w"); if(fp!=NULL) { fprintf(fp,"%s\n", "success!"); fclose(fp); printf("ok!"); } }
对下面程序描述正确的是( )。 #include <stdio.h> #include <stdlib.h> void main() {FILE *in,*out; if((in=fopen("file1.txt","a+"))==NULL) {printf("cannot open file1\n"); exit(0); } if((out=fopen("file2.txt","a+"))==NULL) {printf("cannot open file2\n"); exit(0); } while(!feof(out)) fputc(fgetc(out),in); fclose(in); fclose(out); }