Welcome Guest. Please Login or Register. Apr 1st, 2018, 04:59am
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. We apologize Conforums does not have any export functions to migrate data. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
File Versioning
« Thread started on: Nov 1st, 2015, 09:39am »
Is there an accessible place in a file (RAF in my case) that I can use to indicate a file's version?
I'm thinking that I may want to change the structure (FIELDs) in a file at some point. I want to add the check routine in the program from the start. I do realize that the first version doesn't need to check if the following versions maintain compatibility, but I'm not sure I'll be able to maintain compatibility. I'm thinking I'll have to provide an upgrade only sequence.
I used to do this by adding a FIELD in the file, but it was always a bit klunky doing it that way. I really don't want anything in my file that isn't data.
Modern filing systems do often support 'metadata' or 'alternate streams' which are stored independently of the file itself, but I would advise against using them because if you transfer your file to a different file system which doesn't support metadata (for example copy it onto a FAT-formatted USB stick or compress it in a ZIP archive) the version info may well be lost.
So if you want to keep the version info reliably, you will need to store it somewhere within the file (e.g. reserve the first record for that purpose). Although Liberty BASIC expects you to use the same field structure for every record, that is not enforced (at least, it is not enforced in LBB) so you could do a simple PRINT to (or INPUT from) the very beginning of the file so long as you can guarantee that (including the CRLF) it's not any bigger than the record length.
Re: File Versioning
« Reply #2 on: Nov 1st, 2015, 2:14pm »
Long story short, I got into the habit of including a "CRLF" FIELD at the end of every record in an RAF. (It was for accessing the file in a different way.)
Guess I'll just keep that up and, like you say, use the first record for "configuration" stuff.