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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrieve few characters from a Textfile in ASP file?

Status
Not open for further replies.

icy111

Programmer
Dec 13, 2001
39
US
Dear all

I had this error message:

Microsoft VBScript runtime error '800a003e'

Input past end of file

When i'm opening a Text File, using ReadLine Method.
But i need to retrieve first 6 characters of every line, how should i go about it?

The following is my coding..

Set objTextStream = objFSO.OpenTextFile(Server.MapPath(strFileName), fsoForReading, false)

'Read while not end of stream
Do while objTextStream.AtEndOfStream = false
objTextStream.Skip(iskipcharacters)
currLine = objTextStream.ReadLine Response.Write(currLine) & &quot;<br>&quot;
currtext = Mid(currLine, 1, 6)
Response.Write(currtext) & &quot;<br>&quot;

Loop
objTextStream.Close
Set objTextStream = Nothing

Thanks in advance.

Regards
icy111
 
Try this:

Do Until objTextStream.AtEndOfStream
currLine = objTextStream.ReadLine
Response.Write(currLine) & &quot;<br>&quot;
currtext = Left(currLine,6)
Response.Write(currtext) & &quot;<br>&quot;
Loop
objTextStream.Close
Set objTextStream = Nothing

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
TwoOdd,

How do i upload the textfiles to the webserver, so that i can open & read. Or is there other method where i can open the files locally.

Currentlty, all users don't have the access right to the webserver.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top