讀取INI檔案

2021-04-13 23:31:12 字數 849 閱讀 7464

//讀取ini檔案 ini ini = new ini(); 

using system;

using system.text;

using system.runtime.interopservices; 

namespace qf 

public string path;

//引用動態連線庫方法

[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 void write(string section,string key,string value)

/// 

/// 讀取ini資料

/// 

/// 

/// 

/// 

/// 

public string read(string section,string key)}} 

讀取ini檔案

自定義讀取ini檔案中的內容方法 鍵 值 private string contentvalue string section,string key 寫入ini檔案 節點名稱 如 typename 鍵 值 檔案路徑 dllimport kernel32 private static extern l...

讀取ini檔案

1.得到當前根目錄 import os 2.ini檔案組成 注釋內容 section部分 key value 多個 section 部分 可以有多個,但section不可重複 key value 多個 3.讀取ini檔案 3.1獲取ini檔案路徑 3.2匯入 configparser 3.3 先獲得...

C 讀取INI檔案

class inifile public bool setint string szsection,string szkey,int ival public bool setstring string szsection,string szkey,string szval public uint32...