求一个操作ini的类 参考下面的http://www.cppblog.com/twzheng/archive/2008/03/10/44086.htmlhttp://www.codeproject.com/KB/cs/cs_ini.aspx 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class INIClass { public string inipath; [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); public INIClass(string INIPath) { inipath = INIPath; } public void IniWriteValue(string Section,string Key,string Value) { WritePrivateProfileString(Section,Key,Value,this.inipath); } public string IniReadValue(string Section,string Key) { StringBuilder temp = new StringBuilder(500); int i = GetPrivateProfileString(Section,Key,"",temp,500,this.inipath); return temp.ToString(); } public bool ExistINIFile() { return File.Exists(inipath); } } http://topic.csdn.net/u/20090916/18/eb513432-0d5a-4f44-b2cc-9631cd711f9f.html 索引超出范围。必须为非负值并小于集合大小。参数值:index; c# webbroswer textarea成功导入后却无法正确提交 C#网站死机解决方案 wince问题,高手近来看看。C#调用ocx(c++) 一个SQL的问题 wcf 启动时报错协定需要双工 nettcp协议 多线程是什么意思? Assembly.Load !?!?!?!?!?!?!?!?! 100分求购C#+xml的相关资料 我觉得C#的接口真是太独特了. C# 反射指定类的子类 像VS上面工具箱上面的自动隐藏,窗口位置那种按钮怎么做?
{
public string inipath;
[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);
public INIClass(string INIPath)
{
inipath = INIPath;
}
public void IniWriteValue(string Section,string Key,string Value)
{
WritePrivateProfileString(Section,Key,Value,this.inipath);
}
public string IniReadValue(string Section,string Key)
{
StringBuilder temp = new StringBuilder(500);
int i = GetPrivateProfileString(Section,Key,"",temp,500,this.inipath);
return temp.ToString();
}
public bool ExistINIFile()
{
return File.Exists(inipath);
}
}
http://topic.csdn.net/u/20090916/18/eb513432-0d5a-4f44-b2cc-9631cd711f9f.html