Results 1 to 3 of 3

Thread: Read text from textfile?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2001
    Location
    Sweden - land of the mooses
    Posts
    44

    Read text from textfile?

    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.
    I mean I want all the text in file.txt to go into the variable strText, for example.

    Thankya in advance!
    /Hoffe

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    Code:
    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

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2001
    Location
    Sweden - land of the mooses
    Posts
    44

    Thumbs up

    Works p e r f e c t ! Thanx!
    /Hoffe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width