如何一次性把多行文本读入到一个string变量中
编号:QA003294
建立日期: 2000年8月29日 最后修改日期:2003年11月8日
所属类别:
Q
吴若童:
操作系统: windows98
编程工具: VB6
问题: 如何一次性,把多行文本(有上万行),读入到一个string变量中?(不用richtext)
A回答:
可以用下面的方法一次将全部文件读入:
Open "d:\test1.txt" For Binary As filenum1
TextLine = Space(LOF(filenum1))
Get filenum1, , TextLine
不过如果你的文件有上万行的话,这样处理将会很慢。
赵飞荣的意见:
open "d:\test.txt" for input as #1
a=strconv(inputb(lof(1),1),vbUnicode )
close #1
此问题由李海回答。
附加关键字:编程, 源程序, programming, source code, Visual Basic, VB, 磁盘、文件和目录, disk, file, fat, directory, folder。
| |
|
|
| |
|
|