MFC中CString转化为char*

char* convertCStringToChars(CString string)
{
    int nLength=string.GetLength();
    char *c=new char[nLength+1];
    memset(c,0,nLength+1);
    WideCharToMultiByte(CP_ACP,0,string,nLength,c,nLength,NULL,NULL);
    return c;
}
posted @ 2015-08-14 09:50  庭庭小妖  阅读(549)  评论(0编辑  收藏  举报