Open worpath & "CALS.dat" For Input As #FileNo
      Do Until EOF(FileNo)
        Line Input #FileNo, strWk
        If Left(strWk, 9) = "workPath=" Then
            pathMdb7000 = Right(strWk, Len(strWk) - 9) & "\Cals.mdb"
            Exit Do
        End If
    Loop
    Close #FileNo我想用WINDOWSAPI函数来读取文件的内容
我现在用的是CreateFile,ReadFile这两个函数来读取的。但读取出来的是整个内容。而它本身的语句是一行一行读取,再判断的。
我如何也能一行一行的读取呢。

解决方案 »

  1.   

    为何不用File System Object 内的 TextStream ReadLine()??
      

  2.   

    Private Function ReadTextFile(ByVal FileName As String) As String    Dim FS As New FileSystemObject
        Dim Stream As TextStream
        Dim strLine as String    Set Stream = FS.OpenTextFile( _
          FileName, ForReading, False)   strLine = strLine & Stream.ReadLine()
       Stream.Close   Set FS = Nothing   ReadTextFile = strLine
    End Function用法:
    Text1 = ReadTextFile("C:\abc.txt")
      

  3.   

    FileSystemObject为什么定义不了呢。我点NEW的时候怎么没出来 FileSystemObject。
      

  4.   

    去 Project --〉 References 选 Microsoft Scripting Runtime