Top 10 Record And Writeline
How I can write new line array?. And How I can read top 10 records?
Dim arrFileLines()
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\FSO\Scr开发者_运维技巧iptLog.txt", 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
Wscript.Echo arrFileLines(l)
Next
Thanks for Answers
Dim FileContents, arrFileLines
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\FSO\ScriptLog.txt", 1)
FileContents = objFile.ReadAll()
objFile.Close()
Set objFile = Nothing
arrFileLines = Split(FileContents, vbCrLf)
Dim i, j
For i = LBound(arrFileLines) To UBound(arrFileLines)
Response.Write(arrFileLines(i))
j = j + 1
If (j > 10) Then
Exit For
End If
Next
精彩评论