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.

Dark GDK / dbSaveArray? What do I use to save an array now? Individual write to file commands?

Author
Message
Twisted Steel Software
17
Years of Service
User Offline
Joined: 21st May 2007
Location: Teh Interwebs
Posted: 24th Nov 2007 07:16
dbSaveArray? What do I use to save an array now? Individual write to file commands?

Thanks in advance,
Jim

Intel Pentium 4 3.40 Ghz HT, 1.5 GB RAM, Nvidia Geforce 6800, 19" Dell CRT Monitor ... I need to upgrade ^-^
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 24th Nov 2007 09:11
eh-h... Can I use old DBPro arrays in DGDK?

How?


Sorry, dont know what u mean.. just had to ask my own question to, it fitted so good under this title.

Twisted Steel Software
17
Years of Service
User Offline
Joined: 21st May 2007
Location: Teh Interwebs
Posted: 24th Nov 2007 09:18
hayer: You use C++ arrays instead. int bob[5][5] is an multidimensional array... 5 cases with 5 pockets in each case.

All: I've got it now..... below is the code I used to save a matrix out of a program




-Jim

P.S. Feel free to use that function anywhere... I hope someone gets something out of it.

Intel Pentium 4 3.40 Ghz HT, 1.5 GB RAM, Nvidia Geforce 6800, 19" Dell CRT Monitor ... I need to upgrade ^-^
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 24th Nov 2007 09:31
@Shiny Edge Studios
How can I make a dynamic array?
So when ever I need 1slot more I can add it with a simple command.

Twisted Steel Software
17
Years of Service
User Offline
Joined: 21st May 2007
Location: Teh Interwebs
Posted: 24th Nov 2007 10:08
I believe it's accomplished with the use of pointers... I still do not understand pointers.. so beats me.. The only thing I'm able to do with pointers is this void function_randomness(char *name) and have the name as long as needed. The * says to the compiler make dynamic I THINK...

Intel Pentium 4 3.40 Ghz HT, 1.5 GB RAM, Nvidia Geforce 6800, 19" Dell CRT Monitor ... I need to upgrade ^-^
Twisted Steel Software
17
Years of Service
User Offline
Joined: 21st May 2007
Location: Teh Interwebs
Posted: 24th Nov 2007 10:12 Edited at: 24th Nov 2007 10:41
Sorry for double post.

SKIP TO NEXT POST

Intel Pentium 4 3.40 Ghz HT, 1.5 GB RAM, Nvidia Geforce 6800, 19" Dell CRT Monitor ... I need to upgrade ^-^
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 24th Nov 2007 10:32
Thanks

Now I can kill some time

Twisted Steel Software
17
Years of Service
User Offline
Joined: 21st May 2007
Location: Teh Interwebs
Posted: 24th Nov 2007 10:48 Edited at: 24th Nov 2007 10:56
READ HERE!!! CORRECT WORKING EXAMPLE FINALLY!!!

Ok..
What needs to be done for multidimensional arrays is:



Let me explain.
Two asterisks (*) are placed in front of the variable name as it is declared. That will say two dimensional to the compiler... you place an asterisk after the float saying that you want to set the first dimension to <this> size.
The next dimension must be placed AFTER the other one in memory.. or the program crashes. A for loop is set up to make sure it's after the memory which the previous dimension used...


Oh... and hayer? Thank you. Thank you so much for finally making me sit down and learn dynamic memory with pointers properly... you win a cookie!

Intel Pentium 4 3.40 Ghz HT, 1.5 GB RAM, Nvidia Geforce 6800, 19" Dell CRT Monitor ... I need to upgrade ^-^
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 24th Nov 2007 11:49
yay!
Jummyjummy COOKIE!

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Nov 2007 15:39
Ugh! Raw arrays & pointers

If you want auto-expanding arrays, use an STL vector - you can even get jagged arrays with vectors.



... although I wouldn't use that directly in code myself - still too error prone. I'd wrap it in it's own class:


(Don't worry - already had this lying around ).

You'd use it like this:


You can even copy one array into another with this class, and you'll notice - not one pointer, memory allocation or raw array in sight to muck up on.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 24th Nov 2007 23:58
can i use that in commercial products?

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Nov 2007 17:39
Yes - any code I post on this site is intended for the public domain (ie, I release all copyright)

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code

Login to post a reply

Server time is: 2024-11-19 17:39:00
Your offset time is: 2024-11-19 17:39:00