社区
C#
帖子详情
C#中如何读、写INI配置文件?
alf
2003-10-24 11:00:42
如题!
...全文
96
2
打赏
收藏
C#中如何读、写INI配置文件?
如题!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
qiuji
2003-10-24
打赏
举报
回复
C#读写INI文件:
http://www.zdnet.com.cn/developer/code/story/0,2000081534,39065664,00.htm
http://developer.ccidnet.com/pub/article/c1137_a26002_p1.html
bGene
2003-10-24
打赏
举报
回复
加载命名空间:
using System.Text;
using System.Runtime.InteropServices;
调用API
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath);
写INI文件
string FilePath = Application.StartupPath + "Test.ini";
string Section = "Section"; //段落名
string Key = "Key"; //节点名
string KeyValue = "KeyValue"; //节点值
long temp = WritePrivateProfileString(Section,Key,KeyValue,FilePath);
if(temp>0)
MessageBox.Show("成功写入INI文件!","信息");
读INI文件
StringBuilder Temp = new StringBuilder(255);
string FilePath = Application.StartupPath + "Test.ini";
string Section = "Section"; //段落名
string Key = "Key"; //节点名
int i = GetPrivateProfileString ( Section,Key,"无法读取对应数值!",Temp,255,FilePath);
//显示读取的数值
MessageBox.Show(Temp.ToString());
在
C#
中
读
写
INI
配置
文件
在
C#
中
读
写
INI
配置
文件
个人珍藏版一般人我可不让他下载哦 大家赶紧下吧
C#
基本
读
取和
写
入
INI
配置
文件
C#
基本
读
取和
写
入
INI
配置
文件
C#
文件
系统的操作
本课程将介绍如何在
C#
中
执行
读
写
文件
操作,
读
写
文件
夹操作。
C#
WinForm
读
写
INI
文件
C#
WinForm
读
写
INI
文件
C#
WinForm
读
写
INI
文件
C#
WinForm
读
写
INI
文件
C#
.net
读
取
ini
配置
文件
C#
.net
读
取
ini
配置
文件
C#
110,561
社区成员
642,566
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章