So, i have a lib file where i have function which converts string to char* :
void Additional::str2Char(string s,char** cstr)
{
*cstr = new char[s.length() + 1];
*cstr = (char*) s.c_str();
}
Then, i create console app, and do this:
int main()
{
Additional *a = new Additional();
string b = "fdfd";
char *test;
a->str2Char(b, &test);
cout << test << endl;
delete a;
}
The ouput is really bad.. Help me, i dont know how to get the pointer from lib right.