Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript end of file

Status
Not open for further replies.

badcode

Programmer
Aug 7, 2002
22
US
Is there a way to read a text file one line at a time ( I would think so) if so how?
 
hi,
u try this out this will help u..

<html>
<body>
<p>This is the first line of the text file:</p>
<%
Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f=fs.OpenTextFile(Server.MapPath(&quot;testread.txt&quot;), 1)
Response.Write(f.ReadLine)
f.Close
Set f=Nothing
Set fs=Nothing
%>

</body>

happy programming
suresh
 
This will read the first line. How would I read each additional line(s) until end of the file.
 
See if this works.

<%
Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f=fs.OpenTextFile(Server.MapPath(&quot;testread.txt&quot;), 1)
Do While Not f.AtEndOfStream
Response.Write(f.ReadLine)
Loop
f.Close
Set f=Nothing
Set fs=Nothing
%>


Cornboy88
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top