1、获取应程序同极目录下的config.ini路劲

void GetConfigFilePath(char *path,int len, char *file)
{
char module[256] = {0};
GetModuleFileName(NULL, module, MAX_PATH);
char *ptr = strrchr(module, '\\');
int ptrsize = strlen(ptr);
int modulesize = strlen(module);
memset(path,0,len*sizeof(char));
memcpy(path,module,modulesize-ptrsize);
sprintf(path,"%s\\%s",path,file);
} 2、读取ini文件
int len = 0;
char m_configPath[1024] = {0};
char m_ParentIP_Char[256] = {0};
char m_ChileIP_Char[256] = {0};
char m_Port_Char[256] = {0};
char m_Peer_Port_Char[256] = {0};
char m_PeerID_Char[256] = {0};
char m_SubscriberID_Char[256] = {0}; GetConfigFilePath(m_configPath, len, "Config.ini");
::GetPrivateProfileString("OwnPeer", "ParentIP", "127.0.0.1", m_ParentIP_Char, 256, m_configPath);
::GetPrivateProfileString("OwnPeer", "ChileIP", "127.0.0.1", m_ChileIP_Char, 256, m_configPath);
::GetPrivateProfileString("OwnPeer", "Port", "50000", m_Port_Char, 256, m_configPath);\
::GetPrivateProfileString("OwnPeer", "PeerPort", "50010", m_Peer_Port_Char, 256, m_configPath);
::GetPrivateProfileString("OwnPeer", "PeerID", "131071", m_PeerID_Char, 256, m_configPath);
::GetPrivateProfileString("OwnPeer", "SubscriberID", "131071", m_SubscriberID_Char, 256, m_configPath);

  

VS VC 读取 INI文件的更多相关文章

  1. C#读取ini文件的方法

    最近项目用到ini文件,读取ini文件,方法如下: using System; using System.Collections.Generic; using System.Linq; using S ...

  2. C# 读取ini文件,读不出来原因

    先赋上相关读取ini文件代码 public class INIHelper { public string inipath; [DllImport("kernel32")] pri ...

  3. C# 通过api函数GetPrivateProfileString读取ini文件,取不到值

    通过api函数GetPrivateProfileString读取ini文件,取不到值,测试了好长时间,都不行 确认程序,ini文件都没有错误的情况,最后发现是ini文件编码的原因. 将ini文件的编码 ...

  4. C# 读取ini文件 百度问问学习文档

    C# 读取ini文件 10 有多个section,现想读取整个ini文件和指定section下所有内容 补充: 发布答案可以,请对准题目啊,我不要指定节点的内容,我知道!我要的是读取指定区域的内容,假 ...

  5. python中configparser模块读取ini文件

    python中configparser模块读取ini文件 ConfigParser模块在python中用来读取配置文件,配置文件的格式跟windows下的ini配置文件相似,可以包含一个或多个节(se ...

  6. bat 读取 ini 文件

    bat 读取 ini 文件 参考链接:https://stackoverflow.com/questions/2866117/windows-batch-script-to-read-an-ini-f ...

  7. java读取ini文件

    ini工具类; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import j ...

  8. Python基础之读取ini文件

    基本使用方法 第一步:准备一份INI文件.如test1.ini [ITEMS] item1=1 item2=2 item3=3 item4=4 [ITEM1] test1=aaa [ITEM2] te ...

  9. VC++ 实现INI文件读写操作

    转载:https://blog.csdn.net/fan380485838/article/details/73188420 在实际项目开发中,会用ini配置文件,在此总结一下对ini读写操作 一:读 ...

随机推荐

  1. beginner’s mistake

    PHP Advanced and Object-Oriented Programming 3rd Edition Related to modularity is abstraction: class ...

  2. protobuffer、gRPC、restful gRPC的相互转化

    转自:https://studygolang.com/articles/12510 文档 grpc中文文档 grpc-gateway,restful和grpc转换库 protobuf 官网 proto ...

  3. Signing for "XXXX" requires a development team.

    [iOS]Signing for requires a development team. Select a development team in the project editor. Code ...

  4. [development][http][libhtp] suricata的http库--libhtp

    首先,从文档来看, 它支持管道化的http, 也可以说过于重量级. 其次, 还没有达到产品化的稳定性. 并不是完全对应我的需求, http模块是一个整体性能相关模块. 应该按需定制更合理. 但是,功能 ...

  5. [troubleshoot][automake] automake编译的时候发生死循环

    在某台特有设备上,编译dssl工程时,竟然发生了死循环. https://github.com/tony-caotong/libdssl 错误日志如下: checking zlib.h presenc ...

  6. 转:Eclipse 各种小图标的含义

    原文地址:https://www.cnblogs.com/widget90/p/7592507.html Eclipse 各种小图标的含义,记录一下. Eclipse的Package Explorer ...

  7. LeetCode 136 Single Number 解题报告

    题目要求 Given a non-empty array of integers, every element appears twice except for one. Find that sing ...

  8. LeetCode 961 N-Repeated Element in Size 2N Array 解题报告

    题目要求 In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is re ...

  9. kubernetes的Kubelet

    1. kubelet简介 在kubernetes集群中,每个Node节点都会启动kubelet进程,用来处理Master节点下发到本节点的任务,管理Pod和其中的容器.kubelet会在API Ser ...

  10. 关于Sentry(转)

    原文:http://blog.csdn.net/largetalk/article/details/8640854 1. Sentry介绍及使用 Sentry is a realtime event ...