字符集转换: Ansi - Unicode
wstring AnsiToUnicode (const string& strSrc )
{
/*!< 分配目标空间 */
int iAllocSize = MultiByteToWideChar(CP_ACP,,strSrc.c_str(),-,NULL,NULL);
WCHAR* pwszBuffer = new WCHAR[ (UINT)iAllocSize ];
if ( NULL == pwszBuffer )
{
return L"";
}
int iCharsRet = MultiByteToWideChar( CP_ACP, , strSrc.c_str(),-,pwszBuffer, iAllocSize );
/*!< 成功 */
wstring wstrRet;
if ( < iCharsRet )
{
(void)wstrRet.assign ( pwszBuffer, static_cast<size_t>( iCharsRet ) );
} /*!< 释放内存 */
delete[] pwszBuffer; return wstrRet;
}