CString is quit handy, while std::string is more compatible with stl container. I am using hash_map, however, hash_map does not support CString as key, so I wish I could convert CString into std::string, is it possible?
Write a CString hash function seems take lots of time.
CString ------> std::string ? how can I do?
std::string ---------->CString:
inline CString toCString(std::string const& str)
{
return CString(str.c_str());
}
Am I right?
VonC's method work! I wish anyone with the same problem can get help from his solution. Thank VonC very much!
Here are more Questions: How to Convert wstring, CString to each other?
//wstring -> CString,
std::wstring src;
CString result(src.c_str());
//CString->wstring.
CString src;
::std::wstring des(src.GetString());
Are there any problem?
how to convert wstring, string to each other?