fgetc函数的作用是指定文件读入一个字符,该文件的打开方式是( )。
A. 只写
B. 追加
C. 读或读写
D. B和C正确
若调用fputc函数成功输出字符,则其返回值是( )。
A. EOF
B. 1
C. 0
D. 输出的字符
设有以下结构体类型:struct st{char name [8];int num;float s[4];} student[50];并且结构体数组student中的元素都已有值,若要将这些元素写到硬盘文件中,以下不正确的形式是( )。
A. fwrite( student ,sizeof(struct st),50,fp);
B. fwrite( student ,50*sizeof(struct st),1,fp);
C. fwrite( student ,25*sizeof(struct st),25,fp);
D. for (i=0;i<50 ;i++) fwrite(student+i,sizeof(struct st),1,fp);
阅读以下程序及对程序功能的描述,其中正确的描述是()。#includevoid main(){FILE *in, *out;char infile[10],outfile[10];int c;printf(“Enter the infile name:\n”);scanf(“%s”,infile);printf(“Enter the outfile name:\n”);scanf(“%s”,outfile);if (( in =fopen( infile, “r”))==NULL){ printf(“cannot open infile\n”);exit(0);}if ((out=fopen(outfile, “w”))==NULL{printf(“cannot open outfile\n”);exit(0);}while ((ch=fgetc(in))!=EOF)fputc(ch,out);fclose(in);fclose(out);}
A. 程序完成将磁盘文件的信息在屏幕上显示的功能
B. 程序完成将两个磁盘文件合二为一的功能
C. 程序完成将一个磁盘文件复制到另一个磁盘文件中
D. 程序完成将两个磁盘文件合并且在屏幕上输出