Solved

Ending ReadLine at EOF

Posted on 2002-05-15
3
1,651 Views
Last Modified: 2012-08-14
Using the Object FSO I want to read each line to a variable. Some sample for clarity:

Set objTextStream = objFSO.OpenTextFile(FileToOpen, 1)
'Want to have line below read until EOF
txtMsg = objTextStream.ReadLine

What is the syntax for EOF so it does not error out?
0
Comment
Question by:dmoring
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:tejaspurani
ID: 7011390
objTextStream.AtendOfStream  


T.P.
0
 
LVL 3

Accepted Solution

by:
tejaspurani earned 50 total points
ID: 7011394

<%
Option Explicit
' Set up constants
Const ForReading = 1
Const Create = False

' Declare local variables
Dim objFSO         ' FileSystemObject
Dim objTextStream  ' TextStreamObject
Dim strLine        ' local variable to store Line
Dim strFileName    ' local variable to store fileName

strFileName = Server.MapPath("textfile.txt")

' Instantiate the FileSystemObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

' use Opentextfile Method to Open the text File
Set objTextStream = objFSO.OpenTextFile(strFileName, ForReading, Create)

If Not objTextStream.AtEndOfStream  Then  

Do While Not objTextStream.AtendOfStream  

strLine = objTextStream.ReadLine ' Read one line at a time
Response.Write strLine ' Display that line
Response.Write "<br>"  
 
Loop

End If

' close TextStreamObject
' and destroy local variables to relase memory
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing
%>
0
 

Author Comment

by:dmoring
ID: 7059009
Worked great!!! Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question