Dim cPath As String
Dim oFso As FileSystemObject
Dim tTextStream As TextStream
cPath = cppath & "SysSetIni"
Set oFso = New FileSystemObject
If oFsoFileExists(cPath) = True Then
Set tTextStream = oFsoOpenTextFile(cPath, ForReading, False, TristateFalse)
tTextStreamSkipLine'跳过一行
mServer = tTextStreamReadLine'读取一行很简单就可以读文本文件内容
例如创建个一个文件 testtxt,内容如下:
hello world
程序代码下面几行即可读出
Open "C:\testtxt" For Input As #1
Input #1,s
Close #1
Msgbox "文件内容是" & s
若是读多行文本的文件这样写即可
Open "C:\testtxt" For Input As #1
Do While Not EOF(1)
Input #1,s
DebugPrint s
Loop
Close #1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)