[email protected] wrote:
Does anyone know of a way of saving data stored in an array on a QL like you 
can with the ZX Spectrum?  Below is a description of the way it's done on the 
Spectum using the SAVE command.

You can save arrays on tape using DATA in a SAVE statement by
        SAVE string DATA array name()

String is the name that the information will have on tape and works in exactly the same way as when you save a program or plain bytes. The array name specifies the array you want to save, so it is just a letter or a letter followed by $. Remember the brackets afterwards; you might think they are logically unnecessary but you still have to put them in to make it easier for the computer. Be clear about the separate roles of string and array name. If you say (for instance)
SAVE "Bloggs" DATA b()

then SAVE takes the array b from the computer and stores it on tape under the name 
"Bloggs".


_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Good morning,

There is not one single command alas, mainly because QL arrays can have any number of dimensions (can Spectrum arrays?), unless there is one in a toolkit somewhere - I wrote my own for use with Q-Route, but it had a fixed number of array elements.

You would need something akin to:

REMark Find number of dimensions in array a$ using

count=0
REPeat loop
   dimension=DIMN(a(count))
IF dimension>0:count=count+1:array_dimensions(count)=dimension:ELSE EXIT loop
END REPeat loop

REMark Open a file and print out each individual array element - this only works on a two dimension array
IF count>0
   OPEN_NEW #3,ram1_test
   FOR x=1 to count
         FOR y=1 to array_dimension(count)
               PRINT #3,a(x,y)
         END FOR y
    END FOR x
END IF

An overall routine gets more complex as you have to cope with multi-dimension arrays and string arrays

But that is a starting point -

Rich

--
Rich Mellor
RWAP Services

http://www.rwapsoftware.co.uk
http://www.rwapservices.co.uk

-- Try out our new site: http://sellmyretro.com


_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to