VS VC 读取 INI文件
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文件的更多相关文章
- C#读取ini文件的方法
最近项目用到ini文件,读取ini文件,方法如下: using System; using System.Collections.Generic; using System.Linq; using S ...
- C# 读取ini文件,读不出来原因
先赋上相关读取ini文件代码 public class INIHelper { public string inipath; [DllImport("kernel32")] pri ...
- C# 通过api函数GetPrivateProfileString读取ini文件,取不到值
通过api函数GetPrivateProfileString读取ini文件,取不到值,测试了好长时间,都不行 确认程序,ini文件都没有错误的情况,最后发现是ini文件编码的原因. 将ini文件的编码 ...
- C# 读取ini文件 百度问问学习文档
C# 读取ini文件 10 有多个section,现想读取整个ini文件和指定section下所有内容 补充: 发布答案可以,请对准题目啊,我不要指定节点的内容,我知道!我要的是读取指定区域的内容,假 ...
- python中configparser模块读取ini文件
python中configparser模块读取ini文件 ConfigParser模块在python中用来读取配置文件,配置文件的格式跟windows下的ini配置文件相似,可以包含一个或多个节(se ...
- bat 读取 ini 文件
bat 读取 ini 文件 参考链接:https://stackoverflow.com/questions/2866117/windows-batch-script-to-read-an-ini-f ...
- java读取ini文件
ini工具类; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import j ...
- Python基础之读取ini文件
基本使用方法 第一步:准备一份INI文件.如test1.ini [ITEMS] item1=1 item2=2 item3=3 item4=4 [ITEM1] test1=aaa [ITEM2] te ...
- VC++ 实现INI文件读写操作
转载:https://blog.csdn.net/fan380485838/article/details/73188420 在实际项目开发中,会用ini配置文件,在此总结一下对ini读写操作 一:读 ...
随机推荐
- [No0000125]WCF安全体系
WCF的安全体系主要包括三个方面:传输安全(Transfer Security).授权或者访问控制(Authorization OR Access Control)以及审核(Auditing).而传输 ...
- 使用PrintDBGridEh进行打印 (转)
使用PrintDBGridEh进行打印 (转) if not ADOQuery1.Active then exit; if ADOQuery1.RecordCount<=0 then ex ...
- odoo中Python实现小写金额转换为大写金额
自动将小写的金额数值转换为大写,方便记录 class project_parm(models.Model): def IIf(self, b, s1, s2): if b: return s1 els ...
- XE 画矩形实现拖拉改变大小(属性)
实现原理: 1.拖一个rectangle控件,Align属性为TOP 2.拖一个Split控件,Align为Top 3.拖Rectangle,Align为Bottom 4.拖Split,Align为B ...
- Python开发【模块】:aiohttp(一)
AIOHTTP 用于asyncio和Python的异步HTTP客户端/服务器 主要特点: 支持客户端和HTTP服务器. 支持服务器WebSockets和 客户端WebSockets开箱即用,没有回调地 ...
- java 集合(三)List接口
package cn.sasa.demo1; import java.util.ArrayList; import java.util.LinkedList; import java.util.Lis ...
- ReentrantLock可重入锁的原理及使用场景
摘要 从使用场景的角度出发来介绍对ReentrantLock的使用,相对来说容易理解一些. 场景1:如果已加锁,则不再重复加锁 a.忽略重复加锁.b.用在界面交互时点击执行较长时间请求操作时,防止多次 ...
- 教你使用SQL数据库复制系列(1-7)
SQL Server 复制系列(文章索引) 一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 前言(Introduction) 复制逻辑结构图(Construction) ...
- dbdeployer 快速安装MySQL8.0各测试环境
Linux系统必须安装有Go语言: 下载最新的包:https://github.com/datacharmer/dbdeployer/releases 解压: tar -xzf dbdepl ...
- IOS 键盘弹出导致的position:fixed 无效问题
解决办法(还未测试): 只需要在中间部分外层div添加css样式position:fixed;top:50px; bottom:50px;overflow:scroll;就可以实现效果,无需插件.可拷 ...