Help with std::string
Hey guys I was wondering if any of you knew how to change a std::string to an LPCSTR. All of my string data is stored as a std::string but the function I need to use will only work with and LPCSTR. Any help would be greatly appreciated.
BTW
The function Iam trying to use is the ID3DXFont::DrawText.
Do you know what an LPCTSTR is a typedef for? const char *. Do you know what member of std::string returns a const char *? c_str.
Happy hacking!
std::string aString;void SomeFunction(LPCTSTR param);...SomeFunction(aString.c_str());
Happy hacking!
Use the .c_str() member:
regards,
Pat.
[edit]
Too slow...[smile]
[/edit]
std::string str;LPCSTR lps = str.c_str();
regards,
Pat.
[edit]
Too slow...[smile]
[/edit]
string str = "This is a string";LPCSTR cstr = str.c_str();
Basically, the c_str() method of the string class return a const char *, and an LPCSTR is the same thing (long pointer to a constant string).
Regards,
jflanglois
[edit] Hmph, beaten
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement