Forum Moderators: open
I am currently using the FileSystemObject to include a file and dynamically replace certain things using the replace() function. The include file i have has 3 lines, can anyone tell me how i can just skip the first line and read only the 2nd and 3rd.
Thanx in advanced.
I dont know how this would work because the right function seems to require me to input a certain number of characters after which it should start. But the thing with my particular situation is that the length of the first line is very dynamic, sometimes it can be very short and sometimes it can be very short.
many thanx in advanced
thanx in advanced
thanx in advanced.
Dim fso, f
Set fso = server.CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\inetpub\wwwroot\Project1\test.txt")
'Skip the First Line
If Not f.AtEndOfStream Then
f.SkipLine
End If
'Now Loop through the remainder of the lines until EOF
Do While Not f.AtEndOfStream
sLineItem = f.ReadLine
Response.Write sLineItem & "<BR>"
Loop
f.close
You can add <br> or vbcrlf after each line also if necessary, by modifying the
fulltext = fulltext & ts.readline
To, for example, fulltext = fulltext & vbcrlf & ts.readline
Hope this helps!
JD
-----------------------
Set fso = Server.CreateObject("Scripting.FileSystemObject")
filename = "C:\whatever\whatever.txt")
fulltext = ""
Set f = fso.GetFile(filename)
Set ts = f.OpenAsTextStream(1, -2)
i = 0
Do While Not ts.AtEndOfStream
i = i + 1
If i > 1 Then
fulltext = fulltext & ts.readline
End If
Loop
Set ts = Nothing
Set f = Nothing
Set FSO = Nothing