Click to See Complete Forum and Search --> : Read text file


jrthor2
08-08-2003, 12:02 PM
I am trying to set 2 different variables based on a text file. My code looks lik this:

Do While Not objTextStream.AtEndOfStream
txt = objTextStream.ReadLine
stat = objTextStream.ReadLine(1)
If (stat) = "0" then
stat_count0 = stat_count0 + 1
Else
stat_count1 = stat_count1 + 1
End If
intLinesReadCount = intLinesReadCount + 1
Response.Write txt & "<br>"
Loop



I get an error on the line that is setting the stat variable (stat = objTextStream.ReadLine(1)). The error is:

Microsoft VBScript runtime error '800a01c3'

Object not a collection: 'ReadLine'

How can I read the same line, but populate different variables with different info from that line?

Thanks

jrthor2
08-08-2003, 08:52 PM
There is more than just 1 character in the line, so how would I parse it to makde the stat variable just first character?

I got it:

stat = (Left(txt,1))