Problem with EOF when there are returns or spaces at the end of the file

battlecat

Registered User.
Local time
Today, 01:01
Joined
Jun 29, 2004
Messages
11
Hi there,

I am doing an access db and here is my problem:

I have text files that are all in this format:

"some kind of text" filename
"some more text" filename2
"blah blah" filename3
...

I have to go through these files line by line and compare the text in the quotes... I can do this fine, except for when the file does not end right after the last word. At the end of some of these files, there are a couple of returns or just some space on a couple lines below the last word.... so I get an error. There are hundreds and hundreds of these files, so it is definitely not possible to go through and delete this extra stuff, so I'm wonder if anyone has any suggestions?

The code I'm using looks like this for each of these text files:

inFile = FreeFile
Open path For Input As inFile

Do While Not EOF(inFile)


Input #inFile, Text, fName
...processing code goes here....

Loop


It works perfectly, but when there is extra space or returns at the end of the file it gives me an error saying "Input past end of file"

Does anyone have any suggestions? I would REALLY appreciate it!!
 
Battle,

Without seeing it, what you need to do is change your one line:

Line Input #1, SomeBuffer

to a loop. Then you can check and if Len(SomeBuffer) = 0 then you
can skip that record (until EOF).

Wayne
 
Thank you so much Wayne!! That worked perfectly, I really appreciate your help :)
 

Users who are viewing this thread

Back
Top Bottom