I never thought of putting control data at the END of a file.
Combined with the 'signature' thing, it could work very simply..
Code:
TYPE ControlRecordType Signature AS STRING * 16 Version AS LONG yadda_yadda as whatever END TYPE DIM CR AS ControlRecordType OPEN "Thefile" FOR BINARY AS hFile SEEK hFile, LOF(hFile) - SIZEOF(CR) GET hFile,,CR IF CR.Signature <> "Zshfdjsah8rnlasn" THEN ' something really, really hard to get by accident AppVersion = %OLD_VERSION ELSE AppVersion = CR.Version END IF CLOSE hFile IF AppVersion = %OLD_VERSION THEN (existing code) ELSEIF AppVersion = 216 THEN (code for version 2.16) ELSEIF AppVersion = 217 THEN (code for version 2.17) END IF
Doesn't [EOF() true condition] also hold true for INPUT files as well?
Of course, if you are keeping track of where you are yourself, this is moot; but others may wish to use EOF() and I thought it best to explain how EOF() is not the same as EOF(). (Go figger!)
MCM
[This message has been edited by Michael Mattias (edited August 09, 2001).]
Leave a comment: