// consoleapplication1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "iostream"
using namespace std;
const short int max_section= 20;
const short int max_section = 20;
int main()
{
//确定ini地址
lpctstr lpfilename="d:\\documents\\visual studio 2015\\projects\\consoleapplication1\\release\\mysetting.ini";
char chsectionnames[max_section] = { 0 };//总的提出来的字符串
char chsection[max_section] = { 0 };//存放一个小节名
int i;
int pos = 0;
int ret=getprivateprofilesectionnames(chsectionnames, max_section, lpfilename);//获取ini文件section个数和数据
int m;
for (i = 0; i < max_section; i++)//循环得到section节名
{
if (chsectionnames[i] == 0 && chsectionnames[i + 1] != 0)//判断section节名是否存在
{
for ( m = pos; m <= i; m++)
{
chsection[m - pos] = chsectionnames[m];//获取小节名
cout << chsection[m - pos] ;
}
pos = i + 1;
cstring str;
str.format("%s", chsection);
cout << str << endl;
}
}
system("pause");
return 0;
}
如对本文有疑问, 点击进行留言回复!!
[ACTF2020 新生赛]Include 1【文件包含】【读取代码】
算法题解 - 牛客编程巅峰赛S1第6场 - 黄金&钻石&王者组
推荐一个程序员必备网站之一:Dev Hints ,非常实用!
网友评论