宽字节与多字节转换

    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 );

posted @ 2011-05-23 21:16  陈朋  阅读(1782)  评论(0编辑  收藏  举报