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 / Use of strings to make a list of items

Author
Message
xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 25th Jan 2012 04:44
Ok, I have a question now for real I want to provide a list of strings to hold player profile names for selection. I had two ideas for this. One was to use std::string and just provide a list of strings. This doesn't work with DarkGDK; apparently there are library conflicts? So my other idea was to use a pointer to a pointer, char **. Hahaha yeah that didn't work either. It keeps causing heap corruptions.



This is a very crude example of what I am trying to do. If anyone has a suggestion as how to implement this sort of functionality I would appreciate it!!!
rockstar8577
12
Years of Service
User Offline
Joined: 22nd Jan 2012
Location:
Posted: 25th Jan 2012 06:23
Just use a double char array or vector, and set the profile name input to allow a certain length?
xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 25th Jan 2012 06:44
Hmmm... interesting. Yeah I guess I COULD do that. Haha I always over-complicate things when it comes to handling strings cuz I LOVE dynamic strings for some reason. It would be alot simpler code. Yep going with that solution until/unless another comes along. Thanks!
JollyGiant
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location:
Posted: 25th Jan 2012 06:55
In the original question it was asked if you can use the standard C++ library with Dark GDK, such as std::string, etc. Can you?
xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 25th Jan 2012 06:56
Haha nevermind. I found my problem. Allocating only a byte for a pointer does not work in a 32-bit system. Or a 16-bit system for that matter lol. That was crashing my code. All fixed!!! And working perfectly I might add...
JollyGiant
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location:
Posted: 25th Jan 2012 07:30
I would still like an answer to my question please.
rockstar8577
12
Years of Service
User Offline
Joined: 22nd Jan 2012
Location:
Posted: 25th Jan 2012 13:50
No problem and i know what you mean. I'm not too keen on chars for strings either, haha. I prefer strings a whole lot more
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 25th Jan 2012 15:52
You can use std::string in DarkGDK, you just have to set your project to "/MT Multi-Threaded" in "Project Settings / C++ / Code Generation"
xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 25th Jan 2012 23:57
Thanks Bigglesworth. I was too seeking an answer to that question. I didn't want to change any of the project options and have my code fail so I let it be Now I can use the string library on my next bit of code, though I must say that using char *s instead of strings will keep the executable files smaller. I don't plan on having a huge executable but my engine will be big enough without the bloat of std::string on top of that!!!

Login to post a reply

Server time is: 2024-03-29 13:27:22
Your offset time is: 2024-03-29 13:27:22