zoukankan      html  css  js  c++  java
  • MFC读写配置文件

     

    void CFileTextDoc::OnIniread()
    {
    // TODO: Add your command handler code here
    CString strStudName;
     
    int nStudAge;
     
    GetPrivateProfileString("Info","Name","默认姓名",strStudName.GetBuffer(MAX_PATH),MAX_PATH,"./student.ini");
     
    //读入整型值
    nStudAge = GetPrivateProfileInt("Info","Age",10,"./student.ini");
    CString strAge;
    strAge.Format("%d",nStudAge);
     
    MessageBox(NULL,strStudName,_T(""),MB_OK);
     
    MessageBox(NULL,strAge,_T(""),MB_OK);
    }
     
    //将信息写入.ini文件中
    void CFileTextDoc::OnIniwrite()
    {
    // TODO: Add your command handler code here
    CString strName,strTemp;
     
    int nAge;
     
    strName="张三";
     
    nAge=12;
     
    WritePrivateProfileString("Info","Name",strName,"./student.ini");
     
    strTemp.Format("%d",nAge);
     
    WritePrivateProfileString("Info","Age",strTemp,"./student.ini");
     
    WritePrivateProfileString("Info","Sex","男","./student.ini");
     
    WritePrivateProfileString("Record","Male","女","./student.ini");
     
    MessageBox(NULL,"文件写入成功!",_T(""),MB_OK);
       
    }
  • 相关阅读:
    华为手机wifi调试adb,断开数据线offlin
    appium 识别抖音视频已经播放完成
    对于学习新知识的一点自我反思
    部分软件激活
    AndroidStudio 创建简单的app
    App 逆向思路
    链家
    pyqt5 截屏
    3.无重复字符的最长子串
    1.两数之和
  • 原文地址:https://www.cnblogs.com/lvdongjie/p/4444108.html
Copyright © 2011-2022 走看看