下面表示追加写功能的语句是( )。
A: fp_file=fopen(str,"wb");ufd[k]->ufdfile[i].flength=WriteF1();
B: fp_file=fopen(str,"ab");ufd[k]->ufdfile[i].flength=ufd[k]->ufdfile[i].flength+WriteF1();
C: fp_file=fopen(str,"wb");ufd[k]->ufdfile[i].flength=ufd[k]->ufdfile[i].flength+WriteF1();
D: fp_file=fopen(str,"wb");ufd[k]->ufdfile[i].flength=WriteF1();
A: fp_file=fopen(str,"wb");ufd[k]->ufdfile[i].flength=WriteF1();
B: fp_file=fopen(str,"ab");ufd[k]->ufdfile[i].flength=ufd[k]->ufdfile[i].flength+WriteF1();
C: fp_file=fopen(str,"wb");ufd[k]->ufdfile[i].flength=ufd[k]->ufdfile[i].flength+WriteF1();
D: fp_file=fopen(str,"wb");ufd[k]->ufdfile[i].flength=WriteF1();
举一反三
- 有以下函数:voidf(){FILE*fp;inti,n=0,k=0;fp=fopen(“source.txt”,”w”);for(i=0;i<5;i++)fprintf(fp,”%d”,i);fclose(fp);fp=fopen(“source.txt”,”r”);fscanf(fp,”%d%d”,&n,&k);printf(“%d,%d”,n,k);fclose(fp);}输出结果为()
- 有以下程序: #include <stdio.h> main() { FILE*fp; int i,a[6] = {1,2,3,4,5,6},k; fp = fopen("data.dat", "w+b"); fwrite(&a[0],sizeof(int),1,fp); for(i=1; i<6; i++) { fseek(fp, 0L, 0); fread(&k, sizeof(int), 1, fp); fseek(fp, 0L, 0); a[i] +=k; fwrite(&a[i], sizeof(int), 1, fp); } rewind(fp); fread(&k, sizeof(int), 1, fp); fclose(fp); printf("%d\n",k); } 程序的运行结果是______。[/i][/i] A: 21 B: 6 C: 123456 D: 11
- 下列程序的输出结果是( ) int main(void) { FILE *fp; int i,k,n; fp=fopen("data.dat","w+"); for(i=1;i<6;i++) { fprintf(fp,"%d",i); if(i%3==0) fprintf(fp,"\n"); } rewind(fp); fscanf(fp,"%d%d",&k,&n); printf("%d%d\n",k,n); fclose(fp); return 0;}
- 要打开一个已存在的非空二进制文件“file”用于修改,选择正确的语句是 。 A: fp=fopen("file","rb+"); B: fp=fopen("file","rb"); C: fp=fopen("file","ab+"); D: fp=fopen("file","wb");
- 若有以下程序: #include <stdio.h> main( ) { FILE *fp; int i, a[6]={1,2,3,4,5,6},k; fp=fopen("data.dat","w+b"); for(i=0;i<6;i++) {fseek(fp,0L,0); fwrite(&a[5-i],sizeof(int),1,fp); } rewind(fp); fread(&k, sizeof(int),1,fp); fclose(fp); printf("%d",k); } 则程序的输出结果是______。 A: 6 B: 1 C: 123456 D: 21