D、 fread(f[0],sizeof(double),10,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
- for(n=0;!feof(fp)&&fread(&tongxun[n],sizeof(structtongxunlu),1,fp);n++);是什么意思?
- 有以下程序#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); fwrite(&a[i], sizeof(int), 1, fp); } fseek(fp, 0L, 0); fread(&k, sizeof(int), 1, fp); fclose(fp); printf("%d\n", k);}程序运行后的输出结果是______。[/i] A: 6 B: 21 C: 123456 D: 654321
- 已知有定义,FILE *fp; char str[] = "Hello!"; fp = fopen("file.dat", "wb");将数组str中存放的字符串写到名为file.dat的二进制文件中。需要的语句是( )。 A: fwrite(str[0], sizeof(char), 1, fp); B: fread(str, sizeof(char), 6, fp); C: fwrite(fp, sizeof(char), 6, str); D: fwrite(str, sizeof(char), 6, fp);
- float f[][][] = new float[3][][]; float f0 = 1.0f; float[][] farray = new float[1][1]; What is valid?() A: f[0] = f0; B: f[0] = farray; C: f[0] = farray[0]; D: f[0] = farray[0][0];