C# 读写 ini 配置文件
/// <summary>
/// 调用系统API 读写 ini 配置文件
/// </summary>
public class RWini
{
#region ========ini 读写======== // 声明INI文件的写操作函数 WritePrivateProfileString()
[System.Runtime.InteropServices.DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); // 声明INI文件的读操作函数 GetPrivateProfileString()
[System.Runtime.InteropServices.DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, System.Text.StringBuilder retVal, int size, string filePath); public static void WriteIni(string section, string key, string value,string path)
{
// section=配置节,key=键名,value=键值,path=路径
WritePrivateProfileString(section, key, value, path);
} public static string ReadIni(string section, string key,string path)
{
// 每次从ini中读取多少字节
System.Text.StringBuilder temp = new System.Text.StringBuilder();
// section=配置节,key=键名,temp=上面,path=路径
GetPrivateProfileString(section, key, "", temp, , path);
return temp.ToString();
} #endregion
}
C# 读写 ini 配置文件的更多相关文章
- [转]VB 读写ini 配置文件
转自 百度知道 C# 读写 ini配置文件 点此链接 'API 声明Public Declare Function GetPrivateProfileString Lib "kernel32 ...
- 自己写的 读写 ini 配置文件类
/// <summary> /// 不调用系统API 读写 ini 配置文件 /// </summary> public class RW_ini { #region ==== ...
- 引用“kernel32”读写ini配置文件
引用"kernel32"读写ini配置文件 unity ini kernel32 配置文件 引用"kernel32"读写ini配置文件 OverView ke ...
- C# 文件的一些基本操作(转)//用C#读写ini配置文件
C# 文件的一些基本操作 2009-07-19 来自:博客园 字体大小:[大 中 小] 摘要:介绍C#对文件的一些基本操作,读写等. using System;using System.IO;us ...
- C#操作读写INI配置文件
一个完整的INI文件格式由节(section).键(key).值(value)组成.示例如:[section]key1=value1key2=value2; 备注:value的值不要太长,理论上最多不 ...
- c#读写ini配置文件示例
虽然c#里都是添加app.config 并且访问也很方便 ,有时候还是不习惯用他.那么我们来做个仿C++下的那种ini配置文件读写吧 其他人写的都是调用非托管kernel32.dll.我也用过 ...
- WritePrivateProfileString等读写.ini配置文件
配置文件中经常用到ini文件,在VC中其函数分别为: 写入.ini文件: BOOL WritePrivateProfileString( LPCTSTR lpAppName, // INI文件中的一个 ...
- C++读写ini配置文件GetPrivateProfileString()&WritePrivateProfileString()
转载: 1.https://blog.csdn.net/fengbingchun/article/details/6075716 2. 转自:http://hi.baidu.com/andywangc ...
- QT读写ini配置文件
/********下面是写ini文件*************************/ //Qt中使用QSettings类读写ini文件 //QSettings构造函数的第一 ...
随机推荐
- 【传输协议】什么是CA证书
1.什么是CA证书. 看过一些博客,写的比较形象具体. ◇ 普通的介绍信 想必大伙儿都听说过介绍信的例子吧?假设 A 公司的张三先生要到 B 公司去拜访,但是 B 公司的所有人都不认识他,他咋办捏?常 ...
- CH4912 Meteors
题意 4912 Meteors 0x49「数据结构进阶」练习 描述 Byteotian Interstellar Union有N个成员国.现在它发现了一颗新的星球,这颗星球的轨道被分为M份(第M份和第 ...
- 如何对oracle数据库进行监控检查
sqlplus '/as sysdba' 手动生成一个oracle数据库的快照 execute dbbms_workload_repository.create_snapshot(); 执行自动工作负 ...
- 快速挂载iso文件到虚拟机系统
在vm软件菜单栏那里选择vm,再选择弹出菜单最下面的设置,如图,找到实体机上的iso文件,保存. 这时候,在虚拟机ls /dev会发现有一个cdrom,这个就是我们的iso文件,不过我们还需要把它挂载 ...
- 基于lfslivecd-x86-6.3-r2145安装vnc和qemu
文章目录 把lfslivecd复制到硬盘上使用 编译安装vnc 前后下载了多个软件包进行编译安装 编译VNC 启动VNC 编译安装qemu 启动VNC客户端并连接虚拟机的vncviewer 把lfsl ...
- MySQL Partition--分区基础
================================================================================= Mysql在5.1版本时增加对分区表 ...
- Fundamentals of Computer Graphics 中文版(第二版) (Peter Shirley 著)
1 引言 2 数学知识 3 光栅算法 4 信号处理 5 线性代数 6 矩阵变换 7 观察 8 隐藏面消除 9 表面明暗处理 10 光线追踪 11 纹理映射 12 完整的图形流水线 13 图形学的数据结 ...
- AI 学习
极简状态机: /* 脚本名称: 脚本作者: 建立时间: 脚本功能: 版本号: */ using UnityEngine; using System.Collections; namespace Voi ...
- Bubble Sort冒泡排序
冒泡排序是一种简单的排序算法. 它每次重复的访问过要排序的数列, 一次比较两个元素, 如果他们的顺错误, 就把他们交换过来. 下面这种图很清晰的解释了什么是冒泡算法. 具体算法描述如下: 1. 比较相 ...
- 随机重拍与抽样(random_shuffle,random_sample,random_sample_n)
//版本一:使用内部的随机数生成器 template<class RandomAccessIterator> void random_shuffle( RandomAccessIterat ...