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构造函数的第一 ...
随机推荐
- mvc core2.1 Identity.EntityFramework Core ROle和用户绑定查看 (八)完成
添加角色属性查看 Views ->Shared->_Layout.cshtml <div class="navbar-collapse collapse"> ...
- C++学习(二十八)(C语言部分)之 文件操作
复习:#define 定义一个宏#include 文件包含#if 条件防止头文件重复包含定义一个宏 判断宏是否定义 判断头文件是否包含#define _STDIO_H_#include<stdi ...
- HTML中嵌套的子frame如何访问父页面中的函数?
我解决的办法,在父页面写了个函数,然后在frame页面调用父页面的函数,具体代码如下: 父:function a(){} 子frame:window.parent.a(); 问题迎刃而解 https: ...
- LeetCode - Minimum Area Rectangle
Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these p ...
- 【BZOJ3240】【UOJ#124】【NOI2013】矩阵游戏
终于看懂一道题QAQ然而NOI都是这种难度题怎么玩QAQ 原题: 婷婷是个喜欢矩阵的小朋友,有一天她想用电脑生成一个巨大的n行m列的矩阵(你不用担心她如何存储).她生成的这个矩阵满足一个神奇的性质:若 ...
- 如何对oracle数据库进行监控检查
sqlplus '/as sysdba' 手动生成一个oracle数据库的快照 execute dbbms_workload_repository.create_snapshot(); 执行自动工作负 ...
- linux日志管理
//有关当前登录用户的信息记录在文件utmp中 //登录进入和退出纪录在文件wtmp中 [root@bogon python]# who //who命令查询utmp文件并报告当前登录的每个用户 /va ...
- C语言函数指针的使用
使用函数指针时一定要注意,因为c不会检查参数是否正确 区分返回指针的函数和函数指针 int *f4();返回一个整数指针 int (*f5)();返回整数的函数指针 int * (*f6)();返回整 ...
- IntelliJ快捷键笔记
1.查找文件:Ctrl+Shift+N 2.大小写转换:Ctrl+Shift+U 3.get/set方法快捷键:Alt+Insert 4. 查看类继承关系:Ctrl+H或者Ctrl+Shift+Alt ...
- openstack--6--控制节点和计算节点安装配置neutron
Neutron相关介绍 早期的时候是没有neutron,早期所使用的网络的nova-network,经过版本改变才有个neutron. quantum是因为商标和别的公司重名了,又改成的Neutron ...