Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Reading Text Files


Message #1 by "Carl Massey" <carl@c...> on Mon, 11 Mar 2002 17:01:37
Hi,



I want to read from a text file.  I have tried to use the code below but 

keep getting a file not found error.  The file does exist and it is called 

what I have specified.



set objFSO = server.CreateObject("Scripting.FileSystemObject")

set objFileObject = objFSO.GetFile("C:\hello.txt")

set ts = objFileObject.OpenAsTextStream()



Cheers



Carl
Message #2 by Oleg Kapeljushnik <c-oleg.kapeljushnik@w...> on Mon, 11 Mar 2002 12:14:07 -0500
You can try something like this :



Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile("C:\hello.txt",2,True)





Oleg.



-----Original Message-----

From: Carl Massey [mailto:carl@c...]

Sent: March 11, 2002 12:02 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Reading Text Files





Hi,



I want to read from a text file.  I have tried to use the code below but

keep getting a file not found error.  The file does exist and it is called

what I have specified.



set objFSO = server.CreateObject("Scripting.FileSystemObject")

set objFileObject = objFSO.GetFile("C:\hello.txt")

set ts = objFileObject.OpenAsTextStream()



Cheers



Carl




$subst('Email.Unsub').



Message #3 by Mark Eckeard <meckeard2000@y...> on Mon, 11 Mar 2002 11:26:27 -0800 (PST)
Try this:



set objFSO 

server.CreateObject("Scripting.FileSystemObject")

set objFileObject = objFSO.GetFile("C:\hello.txt")

set ts = objFileObject.OpenAsTextStream(ForReading,

-2)



Notice the parameters in the OpenAsTextStream line.



HTH,

Mark



--- Carl Massey <carl@c...> wrote:

> Hi,

> 

> I want to read from a text file.  I have tried to

> use the code below but 

> keep getting a file not found error.  The file does

> exist and it is called 

> what I have specified.

> 

> set objFSO 

> server.CreateObject("Scripting.FileSystemObject")

> set objFileObject = objFSO.GetFile("C:\hello.txt")

> set ts = objFileObject.OpenAsTextStream()

> 

> Cheers

> 

> Carl





$subst('Email.Unsub').





__________________________________________________

Do You Yahoo!?

Try FREE Yahoo! Mail - the world's greatest free email!

http://mail.yahoo.com/


  Return to Index