- Dim fso
- Dim logfile
-
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set logfile = fso.OpenTextFile("c:\test.txt")
-
-
-
- '读取上一次位置
- Dim lastPos
- lastPos = getLastPosition("c:\test.txt")
-
- '跳到上一次位置
- Err.Clear
- For I = 1 To lastPos
- logfile.skipLine
- Next
-
- '逐行读取文件
- Do While logfile.AtEndOfStream <> true
-
- Dim msg
- Dim myArray
- msg =logfile.ReadLine
- myArray = split(msg)
-
- Loop
复制代码 test.txt逐渐增加数据进去,请问一下该怎么读取上一次读test.txt的位置,然后继续往下读,就不用重新读一遍文件提高效率(函数getLastPosition该怎么写)
|