假设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
A: Chinang
B: China
C: ChinaBeijing
D: BeijingChina
举一反三
- 中国大学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的内容是
- 执行以下程序后,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 *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文件的内容是(若文件能正常打开)______。 #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