Im trying to make a grep type file compare program, but having some problems.

Basically, the files im trying to comapre arent meant for PC, so there are some wierd ascii chr's.
Like EOF's in the middle of the strings.
I know this cause, for what i got right now, it stops 86 chr's into a 605Mb file.
Anyway, im using the input$ function, and when that comes to the EOF, i get an error, obviously.
How, besides resuming next can i bypass this?
Thanks
-Greg