Kind of a lousy-ass post but Straight to the point (with UNICODE on):
#include <string>
using namespace std;
//..
//from std::string to const char*
string originalStr("Bunny Colvin Kicks Ass");
const char* cnstCharPtr = str.c_str();
//the other way around
string convertedStr(cnstCharPtr); //as simple as this
Cheers
2 comments:
Yeah, it was pretty much the first page that google returned me for "c++ string to const char*", and it works =)
@Andre
cool - I wonder how I got this on the first page without consulting one of those SEO snake oil salesman :)
Post a Comment