How to convert CString in MFC to char[] (character array)
+2
A:
You can use GetBuffer function to get the character buffer from CString.
Naveen
2009-04-24 09:42:53
The type is LPTSTR, strcpy will not work if UNICODE, _UNICODE is defined.
dirkgently
2009-04-24 09:51:27
+5
A:
You use CString::GetBuffer() to get the TCHAR[] - the pointer to the buffer. If you compiled without UNICODE defined that's enough - TCHAR is same as char, otherwise you'll have to allocate a separate buffer and use WideCharToMultiByte() for conversion.
sharptooth
2009-04-24 10:00:55
+2
A:
The best description about the string conversions can be found at the following link http://www.codeproject.com/KB/string/cstringmgmt.aspx
coolcake
2009-04-29 03:49:31