Recently, I have a utilities function of
// T2CA
#include "ATLCONV.H"
std::string Utils::CString2String(const CString& cString)
{
#if _MSC_VER > 1200
// Convert a TCHAR string to a LPCSTR
// construct a std::string using the LPCSTR input
CT2CA tmp(cString);
std::string strStd (tmp);
#else
// Deprecated in VC2008.
// construct a std::string using the LPCSTR input
std::string strStd (T2CA (cString));
#endif
return strStd;
}
I do several simple test it seems work fine. However, when I google around, I see most usage of T2CA in VC6, before they call, they will invoke
USES_CONVERSION;
Is there any thing I had missed out? Shall I invoke my function by :
#else
// Deprecated in VC2008.
// construct a std::string using the LPCSTR input
USES_CONVERSION;
std::string strStd (T2CA (cString));
#endif