WritePrivateProfileSection 示例

#include <windows.h>

int main()
{
    //绝对路径
    char csPath[] = "C:\Users\Lenovo\Desktop\ConsoleApplication3\Debug\config.ini";
    char csBuffer[256];
    //创建节点  没有则创建文件
    bool ret = WritePrivateProfileSection("abc", "test=1", csPath);
    //1 ini 字段名 2 变量名 3变量值 4地址
    ret = WritePrivateProfileString("pen1", "name", "make", csPath);
    //查询  1 要找的字段名 2要找的key  3null  4返回存放缓冲区 5缓冲区大小 6路径
    GetPrivateProfileString("pen1", "name", NULL, csBuffer,sizeof(csBuffer), csPath);
    system("pause");
}
从此山高路远,纵马扬鞭。愿往后旅途,三冬暖,春不寒,天黑有灯,下雨有伞。此生尽兴,不负勇往。
原文地址:https://www.cnblogs.com/feizianquan/p/15118482.html