数据格式是12;23;45;10;………………
数字以分号格开。
Dim str As integer
Private Sub Command1_Click()
   Open "c:/123.txt " For Input As 1  
Do While Not EOF(1)
    Input #1, str
    Print str
Loop                     
    Close #1
End Sub
如何修改,谢谢!

解决方案 »

  1.   

    一次性读完:
    Dim str As String
    Open "c:\123.txt " For BINARY As #1
    str=INPUT(Lof(1),#1)
    Close #1分离数据读取:
    Dim cStr() 
    Open "c:\123.txt " For BINARY As #1
    str=INPUT(Lof(1),#1)
    cStr=Split(str,";")'cStr为数组,你自己作其他操作
    Close #1
      

  2.   

    数据格式是
    12,23
    45,10
    154,345
    ………Dim str(9999) As integer
    dim k as integer
    Private Sub Command1_Click()
        Open "c:/123.txt " For Input As #1  
       Do While Not EOF(1)
        Input #1, str(k),str(k+1)
        k=k+1
    Loop                     
        Close #1
    End Sub
    中间是分号,每个数据都是两位吗?
      

  3.   

    如果数据太大,那分行读取也可以啊.
    Dim cStr() 
    Open "c:\123.txt" For Input As #1
    Do While Not EOF(1)
      Line Input #1,str
      cStr=Split(str,";")'cStr为数组,你自己作其他操作
       .....
    loop
    Close #1