cstring to char *例子

    Cstring m_strDescPath = "";        //类的成员变量

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

    ReadXmlFile(ptxtTemp);
原文地址:https://www.cnblogs.com/xifengib/p/5897121.html