ini文件的保存,使用map更方便
来源:互联网 发布:新仙泥红枣桂圆 淘宝 编辑:程序博客网 时间:2024/06/06 10:54
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <string>
#include <iostream>
#include <windows.h>
#include <map>
using namespace std;
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
//::WritePrivateProfileSection(TEXT("test1"),);
//::WritePrivateProfileString(TEXT("test1"),TEXT("name1"),TEXT("kate"),TEXT("c://test.ini"));
LPTSTR lpPath = new char[MAX_PATH];
strcpy(lpPath, "D:\\IniFileName.ini");
/*WritePrivateProfileString("LiMing", "Sex", "Man", lpPath);
WritePrivateProfileString("LiMing", "Age", "20", lpPath);
WritePrivateProfileString("Fangfang", "Sex", "Woman", lpPath);
WritePrivateProfileString("Fangfang", "Age", "21", lpPath);*/
//LPTSTR LiMingSex = new char[6];
//GetPrivateProfileString("LiMing","Sex",NULL,LiMingSex,6,lpPath);
//cout<<LiMingSex<<endl;
/*const char * lpPath = "D:\IniFileName.ini";
FILE *inifp = fopen(lpPath, "ab+");
char buf[1024] = {0};
while(fgets(buf, 1024, inifp))
{
buf[1023] = '\0';
// cout<<buf;
}*/
LPTSTR Sex = new char[6];
LPTSTR Age = new char[6];
GetPrivateProfileString("LiMing", "Sex", NULL, Sex, 6, lpPath);
GetPrivateProfileString("LiMing", "Age", NULL, Age, 6, lpPath);
string strSex(Sex);
string strAge(Age);
cout<<strSex<<endl;
cout<<strAge<<endl;
//multimap<string, map<string, string>> person;
//person.insert(make_pair("LiMing",make_pair("Sex", strSex)));
map<string, string> atti;
atti.insert(make_pair("Sex", strSex));
//cout<<atti["Sex"]<<endl;
atti.insert(make_pair("Age", strAge));
//cout<<atti["Age"]<<endl;
map<string, map<string, string>> Person;
Person.insert(make_pair("LiMing", atti));
//cout<<Person["LiMing"]["Sex"]<<endl;
map<string, string> atti1;
atti1.insert(make_pair("Sex", "Woman"));
atti1.insert(make_pair("Age", "19"));
Person.insert(make_pair("FangFang", atti1));
cout<<Person["LiMing"]["Sex"]<<endl;
cout<<Person["FangFang"]["Age"]<<endl;
//GetPrivateProfileSection()
return 0;
}
- ini文件的保存,使用map更方便
- 使用ini文件保存密码
- ini文件的简单调用,相比xml更容易使用
- 使用ini文件进行一些设置的保存
- 一个更方便使用的upload类
- INI文件的使用
- 读取保存密码的ini文件
- Cocos2d-x Lua 读取Csv文件,更方便的使用数据
- 使用git快捷方便的保存代码
- macOS: 使用新版plutil命令操作Plist文件更方便
- 更方便的单选框
- 保存ini文件和基本控件的保存函数
- BOOT.ini文件的使用
- NOTES.INI 文件的使用
- 关于ini文件的使用
- easypoi 更方便使用poi
- 使用INI文件来保存软件设置信息示例
- VisualSVN Server----更方便使用的SVN服务器
- db2 用户及授权
- 每天要问自己的5个问题 你的答案是什么?
- MapReduce概念详解
- Rotate Image
- (code jam)Problem C. Numbers
- ini文件的保存,使用map更方便
- 菜鸟之学习STM32单片机(一)认识开发板
- oc语言 ARC机制的简单学习
- js基础知识(笔记)
- OCP-1Z0-051 第13题 q操作符
- 简单迷宫游戏1
- 使用CreatePen()创建自定义画笔
- 小熊维尼的12句超萌暖心格言
- POJ 1503Integer Inquiry