titanandrews
Programmer
Hi,
Does anyone know of an easy way to convert a CString to a string in a Unicode environment? The following code is what I used to use, but now I need my app to be Unicode (#define _UNICODE) and my function no longer works. Any suggestions on how to do this in a safe and efficient manner?
thanks,
Barry
Does anyone know of an easy way to convert a CString to a string in a Unicode environment? The following code is what I used to use, but now I need my app to be Unicode (#define _UNICODE) and my function no longer works. Any suggestions on how to do this in a safe and efficient manner?
Code:
string toStlString(const CString& aString)
{
char *tmpStr = new char[(aString.GetLength() + 1];
strcpy(tmpStr,aString);
string myString = tmpStr;
delete []tmpStr;
return myString;
}
thanks,
Barry