UnicodeToAnsi函数

bool UnicodeToAnsi(const WCHAR* pSrc, char* pDes)
{
    char defaultChar[100];
    BOOL bUseDefaultChar;
    int iByte = WideCharToMultiByte(CP_ACP, 0, pSrc, -1, pDes, 1024, defaultChar, &bUseDefaultChar);
    if (iByte == 0)
    {
        //_stprintf(tszErrMsg, theApp.GetText(_T("%s, cann't convert the source to ansi code page, the error code is 0x%x\n")).c_str(), lpszInput, GetLastError());
        //AfxMessageBox(tszErrMsg);
    }

    return true;
}

posted @ 2011-05-24 10:25  麦峰强  阅读(3620)  评论(0编辑  收藏  举报