下面程序的运行结果是( )。 #include <stdio.h> main() { FILE *fp; int a=2,b=4,c=6,k,n; fp=fopen("test.dat","w"); fprintf(fp,"%d\n",a); fprintf(fp,"%d %d\n",b,c); fclose(fp); fp=fopen("test.dat","r"); fscanf(fp,"%d%*d%d",&k,&n); printf("%d %d\n",k,n); fclose(fp); }
以下程序运行后,文件test.txt的内容是( )。 #include <stdio.h> main() { FILE *fp; char str[][10]={"first","second"}; fp = fopen("test.txt", "w"); if(fp!=NULL) fprintf(fp,"%s",str[0]); fclose(fp); fp = fopen("test.txt", "w"); if(fp!=NULL) fprintf(fp,"%s",str[1]); fclose(fp); }