Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / save array,load array commands?????

Author
Message
pagio
22
Years of Service
User Offline
Joined: 8th Jan 2003
Location: - Please Select -
Posted: 27th Mar 2003 01:00
what exacly these commands do save array to were if i undim the array even if i have saved i can not load it.please any examples (other than db examples)
where i can use that???
Dont forget the retro games
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Mar 2003 04:06
place a zero regardless of array dimension in the save and load array command.

eg if your array was myarray(5,5)

save array bla bla,0 instead of 5,5

Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th Mar 2003 04:21
just an expanded example



Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Robin
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location: United Kingdom
Posted: 29th Mar 2003 14:00
Yes...I'm having problems with loading and saving arrays and was going to put in my own post but then I saw this one.
I notice above you save your files as *.arr...do you have to do this? I save them as *.dat files.
Anyway, I have an array called info(20,10). When the user loads the program, he can enter stuff into the array, and then the array can be saved by the:
save array "info.dat",info(20)
command. is the info(20) at the end right? In the manual it says (index numbers) what is an index number!?
and then next time the program is run the user has the option of loading the information from the array so I use the command:
load array "info.dat",info(20)
Is this right?
The user can then add more stuff into the array and then save it again in the same way it was saved before.
Then a problem occours when the program is next run and the user loads the array again. The only information in the array was the info from when the file was edited and more stuff was added. The information from when the file was first made is lost.
I think the code above is from DBP, but i use DBC
Can anybody help me?!
i also store a number which is how many parts of the twenty in the array have been filled, which i store in
info(20,1)
so that when the array is futher edited, the program knows how many parts of the array have been filled, and can then enter new info into the next part of the twenty in the info(20,10) array.
If you want me to explain more, please ask
thanks
Robin

http://www.thegameszone.has.it
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 29th Mar 2003 16:05
1st Question: No, the array files can be called anything, but .arr make them easier to recognise. Personally, I use .dim
2nd/3rd question: Index numbers are the numbers that show you how big the array is, i.e array(10) -> 10 is the index number. However for loading/saving arrays, this numbers doesnt matter, say your array is called array(10,20), you just use the command



and to load it use



as DB ignores the index numbers when saving and loading.

Whatever I did I didn't do it!
pagio
22
Years of Service
User Offline
Joined: 8th Jan 2003
Location: - Please Select -
Posted: 29th Mar 2003 21:42
when i am doing that save and then reboot the program load a message apears no sutch array exist
i use db(not pro)

Dont forget the retro games
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 29th Mar 2003 22:23
i named them *.arr because for me 'arr' means array, but you can save the data however you like (not that i'd actually save the array in this fashion)
i'm aware you're using DarkBasic Standard/Enhanced not Pro which is the DB i tested the code in prior to posting.

as for the index number ... it is actually just to make sure you're saving an array and not trying to export data it won't recognise
personally i'd like to see arrays go from

dim myArray(0) to dim myArray[0]
just so that they can be handled differently to functions and we won't have to export any numbers of have any of this confusion because we can just go

save array "myArray.arr",myArray[]
would make more sense, atleast to me

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2025-05-16 02:31:51
Your offset time is: 2025-05-16 02:31:51