I have a function that accepts a parameter of type char*, but I am using a CString type, not a char array, how can I convert it?
Thank you
I have a function that accepts a parameter of type char*, but I am using a CString type, not a char array, how can I convert it?
Thank you
you are using VC++, is it? you may try to replace char * to CString first, perhaps some more for correspondence variables in function. Did you tried? In fact, CString can do easily what char * does(as I know).
Try this:
-----
// YourFunction(char *text);
CString string("test");
YourFunction(&static_cast<LPCTSTR>(string));
-----
Kuphryn
look into CStrings GetBuffer() member function.
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.