C 讀寫INI檔案

2021-06-05 13:14:53 字數 939 閱讀 6050

.h

#include class cinimgr

// 帶檔名引數的建構函式

cinimgr(cstring strfile)

// 析構清空鍊錶釋放

~cinimgr()

private:

cstringlist *m_sectiondatalist;

cstringlist *m_sectionlist;

cstring m_strsection;

long m_lretvalue;

cstring m_strfilename;

};

.c

#include "stdafx.h"

#include "inimgr.h"

#include cstring cinimgr::getkeyvalue(cstring strkey,cstring strsection)

long cinimgr::setkey(cstring strvalue, cstring strkey, cstring strsection)

bool cinimgr::sectionexists(cstring strsection)

cstringlist* cinimgr::getsectionnames()

strsectionname = "";

} }return m_sectionlist;

}cstringlist* cinimgr::getsectiondata(cstring strsection)

strsectiondata = "";

} }return m_sectiondatalist;

}void cinimgr::setinifilename(cstring strinifile)

C 讀寫INI檔案

inifile類 using system using system.io using system.runtime.interopservices 因為我們需要呼叫api函式,所以必須建立system.runtime.interopservices命名空間以提供可用於訪問 net 中的 com 物...

C 讀寫INI檔案

using system using system.drawing using system.collections using system.componentmodel using system.windows.forms using system.io using system.runtime...

C 讀寫ini檔案

using system.text using system.runtime.interopservices dllimport kernel32 private static extern long writeprivateprofilestring string section,string k...