A: Basiean
B: BasieFortran
C: Basic
D: FortranBasie
举一反三
- 执行以下程序后,test.txt文件的内容是(若文件能正常打开)______。 #include<stdio.h> main() FILE*fp; char*s1="Fortran",*s2="Basic"; if((fp=fopen("test.txt","wb")==NULL) printf("Can’t open test.txt file\n");exit(1); fwrite(s1,7,1,fp);/*把从地址s1开始的7个字符写到fp所指文件中*/ fseek(fp,0L,SEEK_SET);/*文件位置指针移到文件开头*/ fwrite(s2,5,1,fp); fclose(fp); A: Basican B: BasicFortran C: Basic D: FortranBasic
- 执行以下程序后,test.txt文件的内容是(若文件能正常打开)______。#include <stdio.h>main(){ FILE *fp; char *s1="Fortran",*s2="Basic"; if((fp=fopen("test.txt","wb"))==NULL) { printf("Can't open test.txt file\n");exit(1);} fwrite(s1,7,1,fp);/*把从地址s1开始的7个字符写到fp所指文件中*/ fseek(fp, 0L,SEEK_SET);/*文件位置指针移到文件开头*/ fwrite(s2,5,1,fp); fclose(fp);} A: Basican B: BasicFortran C: Basic D: FortranBasic
- 执行以下程序后,test.txt文件的内容是(若文件能正常打开)()。#include main(){ FILE *fp;char *s1="Fortran",*s2="Basic";if((fp=fopen("test.txt","wb"))==NULL){ printf("Can’’t open test.txt file\n"); exit(1);}fwrite(s1,7,1,fp); /*把从地址s1开始的7个字符写到fp所指文件中*/f seek(fp, 0L,SEEK_SET); /*文件位置指针移到文件开头*/fwrite(s2,5,1,fp);fclose(fp);} A: Basican B: BasicFortran C: Basic D: FortranBasic
- 执行以下程序后,test.txt文件的内容是(若文件能正常打开)______。#includemain() FILE *fp; char *s1="Fortran",*s2="Basic"; if((fp=fopen("test.txt","wb"))==NULL) printf("Can′t open test.txt file\n");exit(1); fwrite(s1,7,1,fp); /*把从地址s1开始的7个字符写到fp所指文件中*/ fseek(fp,0L,SEEK_SET); /*文件位置指针移到文件开头*/ fwrite(s2,5,1,fp); fclose(fp); A: Basican B: BasicFortran C: Basic D: FortranBasic
- 执行以下程序后,test.txt文件的内容是【 】。(若文件能正常打开) #include main() {FILE * fp; char*sl="Fortran",*s2="Basic"; if((fp=fopen("test.txt","wb"))==NULL) {printf("Can’t open test.txt file\n");exit(1);} fwrite(sl,7,1,fp);/*把从地址sl开始的7个字符写到fp所指文件中*/ fseek(fp,0L,SEEK_SET);/*文件位置指针移到文件开头*/ fwrite(s2,5,1,fp); fclose(fp); } A: Basican B: BasicFortran C: Basic D: FortranBasic
内容
- 0
假设fp为FILE* 指针变量,如下代码执行后, char *s1="China",*s2="Beijing"; FILE *fp=NULL; fp=fopen("abc.dat","wb"); fwrite(s2,7,1,fp); rewind(fp); fwrite(s1,5,1,fp); fclose(fp);文件abc.dat的内容是 A: Chinang B: China C: ChinaBeijing D: BeijingChina
- 1
中国大学MOOC: 假设fp为FILE* 指针变量,如下代码执行后, char *s1=China,*s2=Beijing; fp=fopen(abc.dat,wb); fwrite(s2,7,1,fp); rewind(fp); fwrite(s1,5,1,fp); fclose(fp);文件abc.dat的内容是
- 2
以下程序执行后,文件test.txt的内容是() #include void main() { FILE *fp; fp=fopen(“test.txt”,”w”); fprintf(fp,”%s”,”How ”); fclose(fp); fp=fopen(test.txt“,”a”); fprintf(fp,”%s”,”are you!”); fclose(fp); }
- 3
向磁盘文件18-1.txt中输入一行字符。 #include "stdio.h" #include "stdlib.h" main() {【1】 *fp; char ch; if((fp=fopen("18-1.txt","w"))==NULL) { printf("Cannot open. "); exit(0); } while((ch=getchar())!=' ') fputc( 【2】 ,fp); 【3】 ; }
- 4
有以下程序#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