zoukankan      html  css  js  c++  java
  • c#读写INI

    //读写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();
    }
    }
  • 相关阅读:
    02梦断代码阅读笔记之二
    每日日报
    每日日报
    每日日报
    每日日报
    02梦断代码阅读笔记之一
    每日日报
    SQL语句分为哪几种?
    数据库三范式是什么?
    什么是数据库事务?
  • 原文地址:https://www.cnblogs.com/jhabb/p/2038768.html
Copyright © 2011-2022 走看看