万能百科  > 计算机   > 

[单项选择题] 使用Do While循环从打开的文件中逐条读取记录。以下能够正确读取数据的程序段是

2021-07-14   

[单项选择题] 使用Do While循环从打开的文件中逐条读取记录。以下能够正确读取数据的程序段是

A.Open "c:File1.txt" For Input As #1 Do While Not EOF() Line Input #1, strLineLoop

B.Open "c:File1.txt" For Input As#1Do While Not EOF(#1) Line Input #1, strLineLoop

C.FileNo=FreeFileOpen FileNo For Input As #1Do While Not EOF(FileN Line Input #1, strLineLoop

D.FileNo=FreeFileOpen FileNo For Input As #1 DoWhile Not EOF(#FileN Line Input #1, strLine Loop

正确答案:

B

参考解析:

[分析] 本题的内容是考察如何使用文件号。在选项A中,EOF()函数中应有文件号;在选项C和D中都有文件号使用时前后不统一的错误,其中选项D中,“#File No”的表示形式是错误的。

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签