由宽字wchar 转换 char
方法一:
#include <atlconv.h>
USES_CONVERSION;
string xmlfile = W2A(fpath.GetBuffer());
方法二:
char* MyToolUnicodeToAnsi( const wchar_t* szStr )
{
int nLen = WideCharToMultiByte( CP_ACP, 0, szStr, -1, NULL, 0, NULL, NULL );
if (nLen == 0)
{
return NULL;
}
char temp[1000];
memset(temp,0,1000);
char* pResult = temp;
WideCharToMultiByte( CP_ACP, 0, szStr, -1, pResult, nLen, NULL, NULL );
return pResult;
}