I do see where each single is 4 bytes but the strings at '*7' and '*15' are a little confusing. The final remark = 50. I gather that's no coincidence that the Random File is to have 50 records. Is 50 records the same thing as 50 bytes?
OH, the light has struck - it's not numbers of records the LEN is calling for but the Length of EACH record.
Sometimes Steve I wonder why I read it over and over again and still don't see the forest for the trees.
Appreciate your patience
Anytime. :)
You’re correct, the LEN is looking for the length of the records — which is why you need to have fixed length strings for your TYPE. When looking at your previous code, it seemed as if you were expecting a 50 byte record, so I tried to decipher what was needed for your example records 3 and 5, so I guessed at the size 7 and 15 for the string’s limit.
Usually, instead of hard coding a value, it’s often better to just set the record length with the LEN statement.
Open “my file.rnd” FOR RANDOM AS #1 LEN = LEN(ReferenceVariable)
(In this case, it’d be LEN = LEN(EvRecord).)
The main advantage to do it like so?
1) You don’t have to manually count the byte size of your records.
2) You can change the record type and not have to skip around in the code and change hard coded values later.