Hello everyone!
I did a little search for file reading methods and the one I've found for reading Byte arrays looks like this (short form):
VB Code:
ReDim Preserve Temp(LOF(FileNum))
Get FileNum, , Temp
I really wonder, why people didn't yet see this is wrong... the code above reads 1 more byte than necessary because LOF returns the number of bytes where arrays go from 0 to x and not from 1 to x ! The correct code thus would be:
VB Code:
ReDim Preserve Temp(LOF(FileNum) [b]- 1[/b])
Get FileNum, , Temp
(border notice: Preserve is faster - always use it when you're going to overwrite the data anways)
Beware yourself making this error! And you should always be careful when copying other people's code - better test it out before using it!
Fox