Bug in Saving Variables

Authors

Publication

Date

Pages

I ran into something I thought was strange. Try this:

   10 LET a$="sample string"
20 SAVE "sample" DATA a$()

Run, then rewind the tape, then NEW.

   10 LOAD "" DATA a$()
20 PRINT a$
30 PRINT a$()

This does not work. For some reason, if you SAVE a string using the DATA token, the string is saved and then can be loaded back into the computer, but not in a form that can be used.

There is a simple patch that solves this problem by putting the string into a one-dimensional array:

   20 DIM t$( LEN a$)
30 FOR i=1 TO LEN a$
40 LET t$(i)=a$(i)
50 NEXT i

If you SAVE t$, when you LOAD it back in, it can be use as a normal string. Do not ask me why.

Products

 

Media

 

Image Gallery

Source Code

People

No people associated with this content.

Scroll to Top