怎么读取文本文件?急急急
因为不知道 123。txt 的内容, 也就不知道你的对不对?
请把123。txt和程序告诉我。这个问题不难解决。
程序for string data: Please tell me is this right for you。
假设 123。txt是这样:
asdf,erty,wefv,tgbhh,。。。h
deep,cat,red,。。。yellow
。。。。。
。。。。。
Please let me know, what do you think about your program。
Thhis program can read any line and one line h...全部
因为不知道 123。txt 的内容, 也就不知道你的对不对?
请把123。txt和程序告诉我。这个问题不难解决。
程序for string data: Please tell me is this right for you。
假设 123。txt是这样:
asdf,erty,wefv,tgbhh,。。。h
deep,cat,red,。。。yellow
。。。。。
。。。。。
Please let me know, what do you think about your program。
Thhis program can read any line and one line have any number of data。
Now you have two programs。
One is for string and attachment for interger。
Private Sub Command1_Click()
Dim i, j, p, pf As Integer
Dim str As String
Dim cell(0 To 80, 0 To 80) As String
p = 1
i = 0
j = 0
Open "c:\123。
txt" For Input As #1
Do Until EOF(1) = True
Line Input #1, str
pf = InStr(p, str, ",")
Do While (pf <> 0)
cell(i, j) = Mid(str, p, pf - p)
p = pf + 1
j = j + 1
pf = InStr(p, str, ",")
If pf = 0 Then
cell(i, j) = Mid(str, p, Len(str))
End If
Loop
i = i + 1
j = 0
p = 1
Loop
Close #1
For i = 0 To 2
For j = 0 To 9
Text2 = Text2 & cell(i, j) & " "
Next
Next
End Sub
attachment for interger data。
收起