PDA

Click to See Complete Forum and Search --> : Read text from textfile?


Hoffe
May 30th, 2001, 12:52 PM
Hiya!

How do I, with ASP and FSO, read the text in a textfile? All dang tutorials are just showing me how to write to it, for crying out loud. :rolleyes:
I mean I want all the text in file.txt to go into the variable strText, for example.

Thankya in advance!

kovan
May 30th, 2001, 01:10 PM
Set FileStreamObject = CreateObject("Scripting.FileSystemObject")
filename = BaseLocationForTextFiles & filename
Set TextOutput = FileStreamObject.OpenTextFile (filename,1,"FALSE")

While not TextOutput.AtEndOfStream
PrintOutput = TextOutput.ReadLine
If not TextOutput.AtEndOfStream Then
TextOutput.SkipLine()
End If
Wend
Set TextOutput = Nothing
Set FileStreamObject = Nothing

Hoffe
May 30th, 2001, 03:18 PM
Works p e r f e c t ! Thanx! :D