CString转char*

来源:互联网 发布:php 整数保留2位小数 编辑:程序博客网 时间:2024/06/16 17:22
char* pFilePath = NULL;int iLen = 0;CString graycat = CString(_T("Gray")) + CString(_T("Cat"));// CString graycat = _T("Gray") + _T("Cat") //error/** Convert wide char into char */iLen = WideCharToMultiByte(CP_ACP, NULL, csFilePath, -1, NULL, 0, NULL, FALSE);/** Create char pointer space */pFilePath = new char[iLen];if ( pFilePath != NULL ){    WideCharToMultiByte(CP_ACP, NULL, csFilePath, -1, pFilePath, iLen, NULL, FALSE);}


0 0