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 / Help with C++ strings

Author
Message
Mr Snuggles
18
Years of Service
User Offline
Joined: 7th Dec 2004
Location:
Posted: 20th Jul 2005 16:05
Is there a function to convert a std::string into a stupid char* string for use with dgsdk functions?

ooo isn't that precious
OSX Using Happy Dude
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 20th Jul 2005 16:11 Edited at: 20th Jul 2005 16:13
const char* c_str() const;
For compatibility with "older" code, including some C++ library routines, it is sometimes necessary to convert a string object into a pointer to a null-terminated character array ("C-style string"). This function does the conversion. For example, you might open a file stream with a user-specified file name:

string filename;
cout << "Enter file name: ";
cin >> filename;
ofstream outfile (filename.c_str());
outfile << "Data" << endl;

You may need to cast the const part out, but that should be easy enough.

Its amazing what you can find when you do a search for "std::string"

Vote For AtomZ - You know it makes senze
http://spaces.msn.com/members/BouncyBrick/

Login to post a reply

Server time is: 2023-02-06 19:52:00
Your offset time is: 2023-02-06 19:52:00