vb6 访问文本文件出现的问题
以下内容为文本文件内容,
在读取时,只取前三列的内容
后来试着减少字段长度,则全部读出来,请问有什么办法把一条记录全部读出来
[解决办法]
如果行数不是太多,可以按行放到数组中(行数太多了,可考虑用数据库):
Option Explicit
Private Sub Command1_Click()
Dim FileByte() As Byte, i As Long
Dim DataLine() As String, FileNumber As Long
FileNumber = FreeFile
Open "c:\ffinit.txt" For Binary Access Read Lock Read As #FileNumber
ReDim FileByte(LOF(FileNumber) - 1)
Get #FileNumber, , FileByte
DataLine = Split(StrConv(FileByte, vbUnicode), vbCrLf)
For i = 0 To UBound(DataLine)
Debug.Print DataLine(i)
Next
Close #FileNumber
End Sub