MFC读写配置文件
2024-08-28 21:02:22
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); } |
最新文章
- JMeter学习(三十四)测试报告优化
- UOJ25——IOI2014Wall
- Wireshark工具创建过滤器的方式
- ubuntu /etc/network/interfaces 中配置虚拟链路
- Data Pump(数据抽取)介绍
- Spring Boot 探索系列 - 自动化配置篇
- hdu2665-Kth number
- js中年份、月份下拉框
- 团队作业4——第一次项目冲刺 fOURth DaY
- 《Spark Python API 官方文档中文版》 之 pyspark.sql (一)
- linux下 ls -l 命令显示结果每一列代表什么意思
- [BZOJ 4419][Shoi2013]发微博
- 【转载】xilinx 高速收发器Serdes深入研究
- flock
- ORA-08104
- python序列(列表,元组,字典)的增删改查
- MySQL 5.7临时表空间
- ADB not responding
- [django]django缓存
- 【CSS小技巧】 用 CSS 实现一个宽高等比自适应容器