1)首先引入標頭檔案#include
2)獲取應用程式的當前路徑
3)char buf[1000]="";
getcurrentdirectory(1000,buf); //得到當前工作路徑
獲取配置檔案的路徑
char path[1024];
#definesysconfig "config.ini"
sprintf(path,"%s\\%s",buf,sysconfig);
4)讀取配置檔案的字段
char buffer[256];
getprivateprofilestring(_t("config"), _t("sleeps"),_t(""), buffer, 256, _t(path));
C 讀取配置檔案
1 利用系統介面,讀取ini配置檔案,詳情可查詢msdn。這裡做簡單宣告 宣告讀ini檔案的api函式 dllimport kernel32 private static extern int getprivateprofilestring string section,string key,str...
C讀取配置檔案
ifndef cfg op h define cfg op h ifdef cplusplus extern c endif endif define crt secure no warnings include include include define maxline 2048 獲取配置項 i...
C 讀取ini配置檔案
using system using system.io using system.runtime.interopservices using system.text todo 在此處新增建構函式邏輯 public class iniclass 寫入ini檔案 專案名稱 如 typename 鍵 值...