Please say me
what is the actual situation (inner managment or user managment) ?
Thanks to read
If you’re talking about the code I posted, it’s up to the user to manage the issue. Think of it as the following:
PRINT #1, a$;
Does the above need a warning label: “Warning, if a$ is null, nothing will be printed to file.”?
If not, then why would you need one for:
GET #1, , a$
“Warning: If a$ has no length, you’ll receive a null string from the file.”?
It’s up to the user to make certain they handle some things properly for themselves.
DIM a AS STRING * 12 says we’re always going to have a 12-byte string, thus we’ll always GET/PUT/PRINT/etc 12 bytes of information.
DIM a AS STRING gives us a flexible, variable length string, which may or may not be 0 bytes in length. QB64 has no means to know what the actual, desired length should be, so it’s up to the programmer to error trap for such things themselves.
OPEN “temp.txt” FOR BINARY AS #1
a$ = SPACE$(LOF(1))
IF a$ = “” THEN
PRINT “Error — File is blank and has no data. Halting program.”
END ‘or load a different file, or write a batch of default data, or however you wish to handle the problem
END IF
‘Other junk follows