Line Input w/ a One-Row ASCII File...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

It's working...However, I find it apparently doesn't recognize EOF unless I
add...
If vTheFile = "" Then Exit Do

Is there a reason for it not to recognize EOF?
This should apply to all ASCII files...20 rows, etc.. ???

Do While Not EOF(iNumOne)
Line Input #iNumOne, vTheFile
If vTheFile = "" Then Exit Do
.....rest of code is fine...

TIA - Bob
 
A lot of times, the file has a extra blank

Lets assume the "]" is our end of file

does your textfile have:

one
two]


Or

one
two
]

You can open up the text file with notepad and see this by moving the cursor
to the very last line, and then using the right arrow key. You see if there
is extra blank or a single blank line at the end if the cursor can move to
the next line....

This is OFTEN the case....

So, in the above, line input will grab the last line, and that line is blank
(eg = "")

This is quite common occurrence. In your case, it sounds likely there is
MORE then one blank line, so, you might have to keep your test for the blank
line as you have. You can easily see/test this by using the arrow keys in
notepad on the last line of the text document.
 
Albert - I figured that was it.

I will be there tomorrow & check it then.

It's an ASCII file generaed by Visual CE.

Thank you - Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top