How do you save $trings? I tried saving it with my other variables like,
(Example:)
DIM SAVARR[3]
SAVARR[0]=VARIABLE1
SAVARR[1]=VARIABLE2
SAVARR[2]=STRING$
It says type mismatch too. How do I save it?
Unfortunately, different types cannot share an array. If I have a chance, I'd write as follows.
DIM SAVARR$[3]
SAVARR$[0]=STR$(VARIABLE1)
SAVARR$[1]=STR$(VARIABLE2)
SAVARR$[2]=STRING$
You can only save numerical values when saving with an array. This means you can't save text in a binary (DAT) file. At least, not directly.
However, there's a SAVE instruction specially designed to save text. You just need to call SAVE like this...
SAVE "TXT:<Filename>",<String$>
What's more, you can keep the same filename for both the DAT and the TXT file.
You technically can only save one string per TXT file this way, but you can store many strings within a single string by concatenating the strings while separating them with a special character. This explanation could take a while and gets a bit technical, so do say if you need it.
You have two ways of loading it...
LOAD "TXT:<Filename>",FALSE OUT <String$>
<String$> = LOAD("TXT:<Filename>",FALSE)
As always, you should first check if the file exists with CHKFILE, like this...
IF CHKFILE("TXT:<Filename>") THEN
<String$>=LOAD("TXT:<Filename>",FALSE)
ENDIF