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);

 

posted @ 2016-09-22 17:04  xifengIB  阅读(312)  评论(0编辑  收藏  举报