问答题重复多次fclose一个打开过一次的FILE*fp指针会有什么结果?
问答题
重复多次fclose一个打开过一次的FILE*fp指针会有什么结果?
参考解析
解析:
暂无解析
相关考题:
有以下程序#include stdio.hmain(){ FILE *fp; int a[10]={1,2,3},i,n;fp=fopen("dl.dat","w");for(i=0;i3;i++) fprintf(fp,"%d",a[i]);fprintf(fp,"\n");fclose(fp);fp=fopen("dl.dat","r");fscanf(fp,"%d",n);fclose(fp);printf("%d\n",n);}程序的运行结果是A)12300B) 123C) 1D) 321
有以下程序#include stdio.hmain(){ FILE *fp; int i=20,j=30,k,n;fp=fopen("d1.dat","w");fprintf(fp,"%d\n",i);fprintf(fp,"%d\n",j);fclose(fp);fp=fopen("d1.dat","r");fscanf(fp,"%d%d",k,n); printf("%d %d\n",k,n);fclose(fp);}程序运行后的输出结果是A.20 30B.20 50C.30 50D.30 20
有以下程序:#includestdio.hvoid main(){ fILE*fp; int i,a[4]={1,2,3,4},b; fp=fopen("data.dat","wb"); for(i=0;i4;i++) fwrite(a[i],sizeof(int),1,fp); fclose(fp) fp=fopen("data.dat","rb"); fseek(fp,-2L*sizeof(int),1,fp);/*文件中读取sizeof(int)字节的数据到变量b中*/ fclose(fp); printf("%d\n",b);}程序中fseek(fp,-2L*sizeof(int),SEEK_END);语句的作用是( )。A.使位置指针从文件末尾向前移2*sizeof(int)字节B.使位置指针从文件末尾向前移2字节C.使位置指针向文件末尾向前移懂2*sizeof(int)字节D.使位置指针向文件末尾移动2字节
假定当前盘符下有两个如下文本文件:文件名 a1.txt a2.txt内容 123# 321#则下面程序段执行后的结果为#include "stdio.h"void fc(FILE *p){ char c;while((c=fgetc(p))!=′#′)putchar(c);}main(){ FILE *fp;fp=fopen("a1.txt","r");fc(fp);fclose(fp);fp=fopen("a2.txt","r");fc(fp);fclose(fp);putchar('\n');}A.123321B.123C.321D.以上答案都不正确
有以下程序includemain(){FILE*fp;inta[10]={1,2,3},i,n;fp=fopen("d1.daf","w");for( 有以下程序 #include <stdio.h> main() {FILE *fp; int a[10]={1,2,3},i,n; fp=fopen("d1.daf","w"); for(i=0;i<3;i++) fprintf(fp,"%d",a[i]); fprintf(fp,"\n"); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d",n); fclose(fp);A.12300B.123C.1D.321
有以下程序includemain(){FILE *fp;int i=20,j=30,k,n;fp=fopen("D1v.dat","w");fprin 有以下程序 #include<stdio.h> main() {FILE *fp;int i=20,j=30,k,n; fp=fopen("D1v.dat","w"); fprintf(fp,"%d\n",i);fprintf(fp,"%d\n",j); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d%d",k,n);printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是( )。A.20 30B.20 50C.30 50D.30 20
有以下程序 include main() { FILE *fp;int k,n,a[6]={1,2,3,4,5,6}; f 有以下程序 #include<stdio.h> main() { FILE *fp;int k,n,a[6]={1,2,3,4,5,6}; fp=fopen("d2.dat","w"); fprintf(fp,"%d%d%d\n",a[0],a[1],a[2]);fprintf(fp,"%d%d%d\n",a[3],a[4],a[5]); fclose(fp); fp=fopen("d2.daf","r"); fscanf(fp,"%d%d",k,n);printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是A.1 2B.1 4C.123 4D.123 456
有以下程序:includemain(){FILE *fp;int i,k=0,n=0;fp=fopen("d1.dat","w");for(i=1;i 有以下程序: #include<stdio.h> main() { FILE *fp; int i,k=0,n=0; fp=fopen("d1.dat","w"); for(i=1;i<4;i++) fprintf(fp,"%d",i); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d%d",k,n); printf("%d %d\n", k,n); fclose(fp); } 执行后输出结果是( )。A.1 2B.123 0C.1 23D.0 0
有下列程序: include main() { FILE *fp; int a[10]={1,2,3},i,n; 有下列程序: #include <stdio.h> main() { FILE *fp; int a[10]={1,2,3},i,n; fp=fopen("d1.dat","w"); for(i=0;i<3;i++) fprintf(fp,"%d",a[i]); fprintf(fp,"\n"); fclose(fp); fp=open("d1.dat","r"); fscanf(fp,"%d",n); fclose(fp); prinff("%d\n",n); 程序的运行结果是( )。A.12300B.123C.1D.321
有以下程序: #includestdio.h main( ) {FILE*fp;char str[10]; fp=fopen("myfile,dat",""); {puts("abe",ip);fclose(fp); fp=fopen("myfile.dat","a*"); fprintf(fp,"%d",28); rewind(fp); fscanf(fp,"%S",str);puts(str); fclose(fp); } 程序运行后的输出结果是( )。A.abcB.28cC.abc28D.内类型不一致而出错
有以下程序(提示:程序中fseek(fp,-2L*sizeof(int),SEEK_END);语句的作用是使位置指针从文件末尾向前移2 * sizeof(int)字节): #include <stdio.h> main() { FILE *fp; int i, a[4]={1,2,3,4},b; fp=fopen("data.dar","wb"); for(i=0;i<4;i++) fwrite(a[i],sizeof(int),1,fp); fclose(fp); fp=fopen("data.dar","rb"); fseek(fp,-2L*sizeof(int),SEEK_END); fread(b,sizeof(int),1,fp); /*从文件中读取sizeof(int)字节的数据到变量b中*/ fclose(fp); printf("%d\n",b); } 执行后的输出结果( )。A.2B.1C.4D.3
有以下程序include main(){FILE *fp;int i=20,j=30,k,n;fp=fopen("d1.dat","w");fprin 有以下程序 #include <stdio.h> main() { FILE *fp; int i=20,j=30,k,n; fp=fopen("d1.dat","w"); fprintf(fp,"%d\n",i);fprintf(fp,"%d\n",j); fclose(fp); fp=fopen("d1.dat", "r"); fp=fscanf(fp,"%d%d",k,n); printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是A.20 30B.20 50C.30 50D.3020
有以下程序:includemain(){FILE*fp;int i,k=0,n=0; fp=fopen("d1.dat","w"); for(i=1; 有以下程序: #include <stdio.h> main() { FILE *fp;int i,k=0,n=0; fp=fopen("d1.dat","w"); for(i=1;i<4;i++) fprintf(fp,"%d",i); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d%d",k,n);printf("%d%d\n",k,n); fclose(fp); { 执行后的输出结果是( )。A.1 2B.123 0C.1 23D.0 0
有以下程序:includemain(){FILE*fp;int a[10]={1,2,3},i,n;fp=fopen("d1.dat","w");fo 有以下程序: #include<stdio.h> main() {FILE*fp;int a[10]={1,2,3},i,n; fp=fopen("d1.dat","w"); for(i=0;i<3;i++)fprintf(fp,"%d",a[i]); fprintf(fp,"\n"); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d",&n); fclose(fp); printf("%d\n",n); 程序的运行结果是( )。A.12300B.123C.1D.321
以下程序的功能是# include stdio.hmain (){ FILE *fp1;*fp2; fp1=fopen ("file1","r"); fp2=fopen ("file2","w"); while (!feof (fp1)) fputc (fgetc (fp1),fp2); fclose (fp1); fclose (fp2);}A.将磁盘文件的内容显示在屏幕上 B.将两个磁盘文件合为一个C.将一个磁盘文件复制到另一个磁盘文件中D.将两个磁盘文件合并后送屏幕
下述程序向文件输出的结果是_______。includevoid main(){ FILE*fp=fopen("TEST","wb") 下述程序向文件输出的结果是_______。 #include<stdio.h> void main() { FILE*fp=fopen("TEST","wb"); fprintf(fp,"%d%5.of%c%d",58,76273.0,'-'2278); fclose(fp); }A.5876273-2278B.5876273.000000-2278C.5876273-2278D.因文件为二进制文件而不可读
有以下程序#inculde stdio.hmain(){ FILE*Fp;char str[10];Fp=Fopen(“myFile.dat”,”W”);Fputs(“aBc”,Fp);Fclose(Fp);Fp=Fopen(“myFile.dat”,”a+”);FprintFF(Fp,”%d”,28);reWind(Fp);FscanF(Fp,”%s”,str);puts(str);Fclose(Fp);}程序运行后的输出结果是A.aBcB.28cC.aBc28D.因类型不一致而出错
有下列程序: includestdi0.hvoidmain( ) {FILE*fp;inta[10]={1,2,3},i,n; fp=fopen(stdi0.hvoidmain( ){FILE*fp;inta[10]={1,2,3},i,n;fp=fopen(dl.dat,w);for(i=0;i3;i++)fprintf(fp,%d,a[i]);fprintf(fp,”\n”);fclose(fp);fp=open(dl.dat,r)fscanf(fp,%d,&n);fclose(fp);printf(”%d\n”,n);}程序的运行结果是( )。A.12300B.123C.1D.321
以下程序的功能是()includemain(){FILE * fp1;*fp2;fp1=fopen("filel","r");fp2=fopen 以下程序的功能是( ) #include<stdio.h> main() {FILE * fp1; *fp2; fp1=fopen("filel","r"); fp2=fopen("file2","w"); while(!feof(fp1)) fputc(fgetc(fp1),fp2); fclose(fp1);fclose(fp2);}A.将磁盘文件的内容显示在屏幕上B.将两个磁盘文件合为一个C.将一个磁盘文件复制到另一个磁盘文件中D.将两个磁盘文件合并后送屏幕
以下程序的功能是()。includemain(){FILE*fPl;*fp2;fp1:fopen("file1","r");fp2:fopen( 以下程序的功能是( )。 # include <stdio.h> main() {FILE*fPl; *fp2; fp1:fopen("file1","r"); fp2:fopen("file2","w"); while(! Feof(fP1)) fputc(fgetc(fP1),fp2); fclose(fP1);fclose(fp2);}A.将磁盘文件的内容显示在屏幕上B.将两个磁盘文件合为一个C.将一个磁盘文件复制到另一个磁盘文件中D.将两个磁盘文件合并后送屏幕
对于如下程序: #include main( ) { FILE *fp; fp=fopen(“file.txt”,“w”); fprintf(fp,“%s”,“xyz”); fclose(fp); } 若文件file.txt中原有的内容为good,则运行该程序以后,文件file.txt中的内容为()
下列程序的功能是()。 #include main( ) { FILE *fp1,*fp2; fp1=fopen(“d1.dat”,“r”); fp2=fopen(“d2.dat”,“w”); while(!feof(fp1)) fputc(fgetc(fp1),fp2)); fclose(fp1); fclose(fp2); }
单选题有以下程序#include main(){ FILE *fp; int k,n,a[6]={1,2,3,4,5,6}; fp=fopen(d2.dat,w); fprintf(fp,%d%d%d,a[0],a[1],a[2]); fprintf(fp,%d%d%d,a[3],a[4],a[5]); fclose(fp); fp=fopen(d2.dat,r); fscanf(fp,%d%d,k,n); printf(%d%d,k,n); fclose(fp);}程序运行后的输出结果是( )。A123456B14C1234D12
填空题对于如下程序: #include main( ) { FILE *fp; fp=fopen(“file.txt”,“w”); fprintf(fp,“%s”,“xyz”); fclose(fp); } 若文件file.txt中原有的内容为good,则运行该程序以后,文件file.txt中的内容为()
填空题下列程序的功能是()。 #include main( ) { FILE *fp1,*fp2; fp1=fopen(“d1.dat”,“r”); fp2=fopen(“d2.dat”,“w”); while(!feof(fp1)) fputc(fgetc(fp1),fp2)); fclose(fp1); fclose(fp2); }