文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>c#读写INI

c#读写INI

时间:2011-05-06  来源:落冰

//读写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();
}
}
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载