CString 转char *

来源:互联网 发布:批量打印pdf软件 编辑:程序博客网 时间:2024/06/01 10:39
char * CTools::CStringToCharP( CString strIn )
{
    char * buffer = NULL;
    int    iTextLen;
    iTextLen = WideCharToMultiByte( CP_ACP,0,strIn,-1,NULL,0,NULL,NULL );

    buffer = NULL;
    buffer = new char[iTextLen + 1];
    memset( ( void* )buffer, 0, sizeof( char ) * ( iTextLen + 1 ) );
    ::WideCharToMultiByte( CP_ACP,0,strIn,-1,buffer,iTextLen,NULL,NULL );
    return buffer;
}
0 0
原创粉丝点击