如何在VB中读取txt文件中的数字问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 02:54:31
如何在VB中打开txt文件的内容输出成数组?
txt文件中的内容如下:(数字之间以tab空格格开)
1 2 3 4 5
4 5 6 7 8
9 10 11 12 13
输出成格式为
{
{1,2,3,4,5},{4,5,6,7,8},{9,10,11,12,13}
}
的文本文件?

不需要数组..

Private Sub Command1_Click()
Dim A$
Open "C:\1.txt" For Input As #1
A = StrConv(InputB$(LOF(1), #1), vbUnicode)
Close #1
A = "{" & Replace(Replace(A, Chr(9), ","), vbCrLf, "},{") & "}"
Open "C:\1.txt" For Output As #1
Print #1, "{"
Print #1, A
Print #1, "}"
Close #1
MsgBox "OK!"
End Sub