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 Professional Discussion / Save Datafile, Load Datafile Issue

Author
Message
BlackChaos
15
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 20th Mar 2014 15:44
After using the save and load Datafile command I find that data goes missing completely out of the array.


Any help?
tiffer
19
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 20th Mar 2014 15:49
Tend not to use that command. Rather I just create a file and then use the write/read commands.

Cwatson
BlackChaos
15
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 20th Mar 2014 16:56 Edited at: 20th Mar 2014 16:58
Quote: "
Tend not to use that command. Rather I just create a file and then use the write/read commands.
"


Please explain? You said read/write as if they update the file.

If there a easy way to save udt's can someone explain? Otherwise is it possible to write my own dll to handle saving udt array?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Mar 2014 00:25
If you want to write a plain UDT to a file, you have to write it field by field yourself.

If you can provide an example of your code that causes you problems with your array then I'll take a look at it for you.

BlackChaos
15
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 22nd Mar 2014 19:42 Edited at: 22nd Mar 2014 19:44
My code:


Thanks,
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Mar 2014 23:31
Here you go:


The problem was that you were loading an array into memory, but not into an array (you used LOAD ARRAYPTR FROM DATAFILE instead of LOAD ARRAY FROM DATAFILE). Basically you should avoid the ARRAYPTR stuff as you really need to understand the inner workings of DBPro arrays to use it safely and effectively.

BlackChaos
15
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 24th Mar 2014 08:56
Thanks IanM.

I want to learn more about the inner workings of dbpro and memory manipulation. Where can I start?
tiffer
19
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 24th Mar 2014 13:59
You should consult the help for principles > data types. You'll probably find there's no need jump to using pointers.

Cwatson

Login to post a reply

Server time is: 2025-05-13 23:43:33
Your offset time is: 2025-05-13 23:43:33