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 / Passing const_cast<char *> from std::string.c_str to DarkGDK

Author
Message
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 26th Apr 2011 07:35
For simplicity I started to store everything in std::strings. Functions such as dbLoadObject take char* and not its const counterpart.

If I have a std::string str = "filename.x", can I dbLoadObject ( 1, const_cast<char *>str.c_str() )?
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 26th Apr 2011 14:50
Sure, except that the ID number should be the second parameter and there should be parentheses around str.c_str().

Login to post a reply

Server time is: 2024-10-02 17:27:01
Your offset time is: 2024-10-02 17:27:01