#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
int num = ::GetPrivateProfileInt(L"Images", L"level_0", 9, L"C:\\Users\\liuzhichao\\source\\repos\\ConsoleApplication2\\Debug\\config.ini");
wchar_t buf[128];
::GetPrivateProfileStringW(L"Images", L"level_1", L"0", buf, 128, L"C:\\Users\\liuzhichao\\source\\repos\\ConsoleApplication2\\Debug\\config.ini");
std::wstring str = std::wstring(buf);
cout << num << endl;
int num2 = _wtoi(buf);
std::wcout << str << std::endl;
std::wstring strnum = L"168";
WritePrivateProfileStringW(L"Images", L"level_1", strnum.c_str(), L"C:\\Users\\liuzhichao\\source\\repos\\ConsoleApplication2\\Debug\\config.ini");
memset(buf, 0, 128);
GetPrivateProfileSectionW(L"Images", buf, 128, L"C:\\Users\\liuzhichao\\source\\repos\\ConsoleApplication2\\Debug\\config.ini");
str = buf;
return 0;
}
c++ 读写ini文件
猜你喜欢
转载自blog.csdn.net/qq_24127015/article/details/85568251
今日推荐
周排行