c++读取ini的Section节名
// 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;
}
c++读取ini的Section节名的更多相关文章
- c#读取INI文件
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...
- c#读取INI文件类
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;na ...
- Python读取ini配置文件的方式
python configparser模块 ConfigParser模块在python中用来读取配置文件,配置文件的格式跟windows下的ini配置文件相似,可以包含一个或多个节(section ...
- 【Unity3D】用C#读取INI配置文件
由于在C#并没有提供专门读取INI文件的API,所以需要间接调用C++的API来进行读取. using System; using System.Collections.Generic; using ...
- 转 python3 读取 ini配置文件
在代码中经常会通过ini文件来配置一些常修改的配置.下面通过一个实例来看下如何写入.读取ini配置文件. 需要的配置文件是: 1 [path] 2 back_dir = /Users/abc/Pych ...
- Boost.PropertyTree读取ini文件(Linux环境)
昨天因为需要读取配置文件略略伤神.网上很多例子但是我用都会报错,很多人把Boost.PropertyTree的函数写很麻烦的包所以报错我也不知道什么问题,所以今天整理下. 头上附上官网链接:Boost ...
- C# 读取INI
虽然微软早已经建议在WINDOWS中用注册表代替INI文件,但是在实际应用中,INI文件仍然有用武之地,尤其现在绿色软件的流行,越来越多的程序将自己的一些配置信息保存到了INI文件中. INI文件是文 ...
- python中configparser模块读取ini文件
python中configparser模块读取ini文件 ConfigParser模块在python中用来读取配置文件,配置文件的格式跟windows下的ini配置文件相似,可以包含一个或多个节(se ...
- 【python3】configparser读取ini配置文件
在应用过程中,发现下面这个问题: cf=configparser.ConfigParser()读取配置文件时,如果数据包含%这们析特殊符号,就会报出上面的错误,使用cf = configparser. ...
随机推荐
- Java Web高性能开发 - 前端高性能
作者:IBM developerWorks链接:https://www.ibm.com/developerworks/cn/java/j-lo-javawebhiperf1/著作权归作者所有.商业转载 ...
- Tcpdump一些常用指令
1.tcpdump安装:yum install tcpdump 2.关键字介绍 类型关键字: 指定主机 host 192.168.1.111 指定网络地址 net 202.0.0.0 指定端口 por ...
- Server runtime
spring mvc常用的注解: 个介绍. @Controller @Controller 负责注册一个bean 到spring 上下文中,bean 的ID 默认为 类名称开头字母小写,你也可以自己指 ...
- 沉淀,再出发:python爬虫的再次思考
沉淀,再出发:python爬虫的再次思考 一.前言 之前笔者就写过python爬虫的相关文档,不过当时因为知识所限,理解和掌握的东西都非常的少,并且使用更多的是python2.x的版本的功能,现 ...
- 8个PHP数组面试题
1.写函数创建长度为10的数组,数组中的元素为递增的奇数,首项为1. 代码如下: <?php function arrsort($first,$length){ $arr = array(); ...
- 108.UIView关于布局和约束的方法(AutoLayout)
http://blog.csdn.net/wangyanchang21/article/details/52270136 关于布局(UIViewHierarchy) 1.layoutSubviews ...
- BZOJ1177:[APIO2009]Oil(枚举,前缀和)
Description 采油区域 Siruseri政府决定将石油资源丰富的Navalur省的土地拍卖给私人承包商以建立油井.被拍卖的整块土地为一个矩形区域,被划分为M×N个小块. Siruseri地质 ...
- vue2.* 绑定属性 绑定Class 绑定style 03
<template> <div id="app"> <!-- 绑定属性 --> <div v-bind:title="title ...
- 8、RabbitMQ-消息的确认机制(生产者)
RabbitMQ 之消息确认机制(事务+Confirm) https://blog.csdn.net/u013256816/article/details/55515234 概述: 在 Rabbitm ...
- ServletContextListener在Springboot中的使用
ServletContextListener是servlet容器中的一个API接口, 它用来监听ServletContext的生命周期,也就是相当于用来监听Web应用的生命周期.今天我们就来说说如何在 ...