cstring to char *例子

时间:2023-02-08 03:08:30
    Cstring m_strDescPath = "";        //类的成员变量

    //"打开文件"对话框,选择文件,返回其路径
m_strDescPath = BootOpenDialog();
//这里的目的是将Cstring m_strDescPath 转为char *ptxtTemp 供后面使用
int len = WideCharToMultiByte(CP_ACP, , m_strDescPath, -, NULL, , NULL, NULL);
char *ptxtTemp = new char[len + ];
WideCharToMultiByte(CP_ACP, , m_strDescPath, -, ptxtTemp, len, NULL, NULL); ReadXmlFile(ptxtTemp);