宽字节与多字节转换

    int    iTextLen;

     iTextLen = WideCharToMultiByte ( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);

    pElementText = new char[iTextLen + 1];

    memset( ( void* )pElementText, 0, sizeof( char ) * ( iTextLen + 1 ) );

    ::WideCharToMultiByte( CP_UTF8,0,str,-1,pElementText,iTextLen,NULL,NULL );

原文地址:https://www.cnblogs.com/flysnail/p/2054738.html