C#读写本地ini
2024-08-25 09:51:23
- //读写INI
- public class GF_INI
- {
- [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);
- [DllImport("kernel32.dll")]
- public static extern int Beep(int dwFreq, int dwDuration);
- //读ini
- public static void iniFile_SetVal(string in_filename, string Section, string Key, string Value)
- {
- WritePrivateProfileString(Section, Key, Value, in_filename);
- }
- //写INI
- public static string iniFile_GetVal(string in_filename, string Section, string Key)
- {
- StringBuilder temp = new StringBuilder(255);
- int i = GetPrivateProfileString(Section, Key, "", temp, 255, in_filename);
- if (i == 0)
- return "";
- else
- return temp.ToString();
- }
- }
最新文章
- 基于mysql的数据管理
- 《DSP using MATLAB》示例Example5.20
- centos7 firewalld
- How to: Convert Between Various String Types
- java 26 - 7 网络编程之 TCP协议代码优化
- php发送邮件处理功能页面去除重复的邮箱地址
- 字符串 - 近似回文词 --- csu 1328
- beej's 网络编程 打包数据pack data
- BZOJ 1617 渡河问题
- JVM调优总结 -Xms -Xmx -Xmn -Xss(转载)
- 缓存初解(三)---Spring3.0基于注解的缓存配置+Ehcache和OScache
- [改善Java代码]用整数类型处理货币
- PHP学习笔记十三【二维数组】
- live555 for Android
- PHP的魔法方法
- Git版本控制之多人协作
- Android和iOS中Cocos2D日志为什么会出现skip frames
- luogu P1602 Sramoc问题
- arrow function and bind
- html或者jsp页面刷新问题
热门文章
- C#与js的各种交互
- zw版【转发·台湾nvp系列Delphi例程】HALCON SetLineStyle2
- 五、Java基础---------if else、switch总结
- 为什么在我眼里你是一只傻逼——傻逼“常所用”句型之(2)——“当当网的就有XXX人评论,YYY%的推荐”
- SqlServer 的提示符(Option/With等提示符)不是什么时候都可以用的
- intall vs code in elementary os
- Android 多线程通信 访问网络
- Mongodb 笔记06 副本集的组成、从应用程序连接副本集、管理
- 使用 Delphi Xe 的 TDictionary
- Linux终端乱码的解决办法