For the love of God i cannot figure out what i am doing wrong. I have an Input file that i am using to feed into my program and it is supposed to read lines till it hits a line with **** on it. Then it is supposed to do a bunch of things on the lines it read and then it is supposed start of from where it left it. I have the first part down but when it is supposed to start reading lines back up it skips 2 lines. I cannot figure out why. PLEASE HELP!
This is what i have:
Do
i = 0
Line Input #s1, testtype
testtype = Trim(Right$(testtype, Len(testtype) - InStr(testtype, ":")))
Line Input #s1, datadir
datadir = Trim(Right$(datadir, Len(datadir) - InStr(datadir, ":")))
Do
i = i + 1
Input #s1, chnname(i), chncomment(i), dummyser(i), speed(i)
Loop Until InStr(chnname(i), "*******") > 0
linesread = i - 1
.
.
.
.
.
Loop Until linesread >= totallines
where totallines = 111 (number of lines in my input file).
you are reading two lines in the outer loop without increasing i (by 2), I think because in the inner loop i must be 1, but then linesread (i-1) is not the total number of lines
Marco
PS please leave deity, divinity, or gods out of here, there always the risk to offend someone
"There are two ways to write error-free programs. Only the third one works."
Unknown
2 things:
1. I did not mean to offend anyone with my comment. If i did, i apologize. It was completely unintentional.
2. mstraf - i still have no idea how to fix the problem at hand!
or forget the linesread count, and check for EOF (it is much safer and will save headache later), as the first line in the first loop (this is my strong suggestion):
Do
if EOF(s1) then exit do
Marco
"There are two ways to write error-free programs. Only the third one works."
Unknown
Thanks but i figured it out. I made it write a file with what it was reading and i saw that when it was reading the line with ***** it was also reading the next 3 values separated by commas due to the line:
Input #s1, chnname(i), chncomment(i), dummyser(i), speed(i)
but i changed that in my input file and it now reads **** for the 3 variables that follow.
Bookmarks