主题:[原创][求助]:如何从文本文件里面读取指定位置的字符
各位大侠,请问如何从一个多行文本文件中读取指定位置的字符?比如一个文件名为:1.txt,内容如下:
-425612.32563-0.326542.36
45268975.365-96542321.365
...
想从上面的文本文件里面读取第一行的第五到第八个字符,(从第二行里面读取第七到第十五个字符,)请问如何编写程序?谢谢!
请各位大侠帮忙看看:
Private Sub Command1_Click()
Dim i As Integer
Dim str As String
Dim n As Integer
Open "d:\1.txt" For Binary As #1
i = 1
n = 1
While Not EOF(1)
Get #1, 5, str
str = str & str
i = i + 1
n = n + 1
If i = 9 Then
Text1.Text = str
Close #1
Exit Sub
End If
Wend
End Sub
-425612.32563-0.326542.36
45268975.365-96542321.365
...
想从上面的文本文件里面读取第一行的第五到第八个字符,(从第二行里面读取第七到第十五个字符,)请问如何编写程序?谢谢!
请各位大侠帮忙看看:
Private Sub Command1_Click()
Dim i As Integer
Dim str As String
Dim n As Integer
Open "d:\1.txt" For Binary As #1
i = 1
n = 1
While Not EOF(1)
Get #1, 5, str
str = str & str
i = i + 1
n = n + 1
If i = 9 Then
Text1.Text = str
Close #1
Exit Sub
End If
Wend
End Sub