写了一个程序,每隔1秒调用一次下面的函数,但是当此时外部程序 C 读 c:/input.txt,总是报不能读取此文件,报错,不知为什么?'写入
Function WriteTxt(i As Integer) Set fso = CreateObject("Scripting.fileSystemObject")
 Set ts = fso.createTextFile("c:/input.txt", True)
 ts.write (i)
 ts.Close
  
End Function不知道大家有没有相关源程,比较急,谢谢大家。

解决方案 »

  1.   

    没发现读取有什么问题呀,你是怎么读的呢Function WriteTxt(i As Integer)
    --------------------------------------
    Function WriteTxt(ByVal i As Integer)
      

  2.   

    '读取
    Private Sub Timer1_Timer()
        Dim strTmp As String
        Open "c:\input.txt" For Input As #1
            Line Input #1, strTmp
        Close #1
        Debug.Print strTmp
    End Sub
      

  3.   

    楼主是说两个应用程序同时读同一个文件!当c写的一个程序读这个文件的时候,VB程序再去读这个文件就出错!!
      

  4.   

    不是,我是说 只有C读的时候,VB 只是每秒执行上面的程序。