12-17-2022, 01:21 PM
This is an important function, because otherwise we would have to memorize much more than credit card, social security, PIN, passwords and much more that came with the weight of civilization.
It's shocking that "FREEFILE" was rarely, if ever, used in the earliest BASIC code presented by Galleon. I think I saw a "#26" somewhere as file handle. Several variables were being allocated, each one was megabytes in size, but too much trouble to create at least an array of 40 long-integer file handles? Too much typing instead.
"FREEFILE" is one function that was necessary to keep BASIC in pace with C and other languages where the programmer has to refer to a "handle" stored in a variable. In some languages like Lua that variable cannot be an integer. Imagine if we still had to do "PRINT #26" or alike but for images, music and windows. "No you may not use &HDEADBEEF as file handle!"
However, a few languages like Purebasic opted to create single functions combining the functionality of "FREEFILE" and "OPEN", such as "CreateFile", "AppendFile" and "OpenFile" (this last one is to open for input only). Probably it's called "ReadFile", while "OpenFile" is to be used for non-sequential files in either mode.
It's shocking that "FREEFILE" was rarely, if ever, used in the earliest BASIC code presented by Galleon. I think I saw a "#26" somewhere as file handle. Several variables were being allocated, each one was megabytes in size, but too much trouble to create at least an array of 40 long-integer file handles? Too much typing instead.
"FREEFILE" is one function that was necessary to keep BASIC in pace with C and other languages where the programmer has to refer to a "handle" stored in a variable. In some languages like Lua that variable cannot be an integer. Imagine if we still had to do "PRINT #26" or alike but for images, music and windows. "No you may not use &HDEADBEEF as file handle!"
However, a few languages like Purebasic opted to create single functions combining the functionality of "FREEFILE" and "OPEN", such as "CreateFile", "AppendFile" and "OpenFile" (this last one is to open for input only). Probably it's called "ReadFile", while "OpenFile" is to be used for non-sequential files in either mode.