-
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
-
Are you using Line input? or loading the entire file in at once? It sounds like you're hitting End of Line, not end of file.
-
Nope, im not getting end of line, cause i get the error Input past end of file.
I thought of loading the entire doc into a var, but the files im planning on working with are far to big(600+mb)
And i dont think that would solve the problem anyway.
Basically, here is the code i use.
Open file1.Text For Input As #1
Open file2.Text For Input As #2
If LOF(1) <> LOF(2) Then
MsgBox "The File lengths are different.", vbExclamation
End If
For bytenum = 1 To LOF(1)
If Check1.Value = vbChecked Then Exit For
DoEvents
file1str = Input$(1, 1)
file2str = Input$(1, 2)
Debug.Print bytenum & file1str & " pssss " & file2str
If file1str = Chr$(26) Then 'try to detect EOF
Text3.Text = Text3.Text & "Byte " & bytenum & " in file 1 is EOF." & vbCrLf
End If
If file1str <> file2str Then
Text3.Text = Text3.Text & "Byte " & bytenum & " in file 1 is " & file1str & " and is " & file2str & " in file 2." & vbCrLf
End If
Next bytenum
Close
This works fine for all PC based files, txt's com's, whatever. But when i try it on this file(a psx .img file in particular) it hits an eof in the first like 50 chrs
Now, ive tried to use the line input function also, but that stops at that EOF too. So, i need a way to either detect the eof, and skip over it, or something that will read it in, but not stop on it because there is more after the eof.. Do you understand?
Anyway, thanks