/// ReadFile.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//--------------------------------------------------------------------------
/// strip 函数在博客“C++:strip函数以及读取ini配置文件”中,这里不再赘述
//--------------------------------------------------------------------------
#include "pch.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;
//删除ini文件的title及对应的key
void deleteTitle_INI_File(string file_path, string name, string title)
{
ifstream i(file_path + "\\" + name);
vector<string> lines;
bool match_title = false;
if (i.is_open())
{
while (!i.eof())
{
string line;
getline(i, line);
//初步清洗
strip(line);
//二次清洗
if (line[0] == ';')
{
//指定title对应的所有注释都丢弃
if (match_title)
{
C++:删除ini配置文件的title及对应的key
最新推荐文章于 2024-03-21 15:12:45 发布