A: Open "c:\file1.dat" For Output as
B: 1
C: Open "c:\file1.dat" For Input as
D: 1
E: Open "c:\file1.dat" For Print as
F: 1
G: Open "c:\file1.dat" For Write as
H: 1
举一反三
- 用( )语句打开顺序文件File1.txt后,可以进行写操作 A: Open "File1.txt" For Input As B: 1 C: Open "File1.txt" For Output As D: 1 E: Open "File1.txt" For Random As F: 1 G: Open "File1.txt" For Binary As H: 1
- 如果从数据文件 c:\data.txt 中读取数据时,以下打开文件方式中,正确的是( ). A: Open c:\data.txt For Input As B: 1 C: Open c:\data.txt For Output As D: 1 E: Open "c:\data.txt" For Input As F: 1 G: Open "c:\data.txt" For Output As H: 1
- 若要把数据追加到顺序文件D:\Stu.txt末尾,可以使用下列语句实现的是( )。 A: Open "D:\Stu.txt" For Output As B: 1 C: Open "D:\Stu.txt" For Append As D: 1 E: Open D:\Stu.txt For Output As F: 1 G: Open D:\Stu.txt For Append As H: 1
- 要从磁盘上读入一个文件名为"d:\File.txt"的顺序文件,下面程序段正确的是( ). A: Open d:\File.txt For Input As B: 1 C: Open "d:\File.txt" For Output As D: 2 E: Open "d:\File.txt" For Input As F: 2 G: Open "d:\File.txt" For Append As H: 1
- 为了读取数据,需要打开顺序文件“D:\data5.txt”,以下正确的命令是。 A: Open "E:\UserData.txt" For Input As B: 2 C: Open "E:\UserData.txt" For Output As D: 2 E: Open E:\UserData.txt For Output As F: 2 G: Open E:\UserData.txt For Input As H: 1
内容
- 0
若在程序中以追加写的方式打开文件file,则执行下列哪条语句?file若不存在则创建。 A: open("./file",O_RDONLY|O_CREAT|O_TRUNC) B: open("./file",O_WRONLY|O_CREAT|O_APPEND) C: open("./file"O_WRONLY|O_APPEND) D: open("./file",O_RDWR|O_CREAT|O_TRUNC)
- 1
为了读取数据,需打开顺序文件“D:\data5.txt”,以下正确的命令是 A: Open D:\data5.txt For Input As #1 B: Open "D:\data5.txt"For Input As #2 C: Open D:\data5.txt For Output As #1 D: Open "D:\data5.txt"For Output As #2
- 2
要建立文件流并打开当前目录下的文件file. dat用于输入,下列语句中错误的是______。 A: ifstream fin=ifstream. open("file. dat"); B: ifstream *fin=new ifstream("file. dat"); C: ifstream fin; fin. open("file. dat"); D: ifstream *fin=new ifstream(); fin->open("file. dat");
- 3
以下叙述中不正确的是 。 A: Open语句的功能是打开一个已经存在的文件 B: 随机文件每条记录的长度是固定的 C: 执行如下命令后,文件指针指向文件的开头: Open "C:\Data\File1.Dat" For Output As D: 1 E: 以下循环语句中的条件表示当到达文件结尾时结束循环: Do While Not EOF(1) <循环体语句> Loop
- 4
以下程序是把文件file1.dat中的内容复制到一个名为file2.dat新的文件中,请补全程序。#includevoidmain(){FILE*fpr,*fpw;if((fpr=fopen("file1.dat","rb"))==NULL)exit(0);if((fpw=fopen(________________,"wb"))==NULL)exit(1);while(!feof(fpr))fputc(_________________,fpw);fclose(fpr);fclose(fpw);}