API: GetPrivateProfileSection, WritePrivateProfileSection

API: GetPrivateProfileSection, WritePrivateProfileSection

GetPrivateProfileSection() 可以取得 INI 某個 section 的全部內容,內容會存成 stringA\0stringB\0stringC\0\0 的格式。

 
char szBuffer[8192] = "";
ZeroMemory(szBuffer, sizeof(szBuffer));
if (GetPrivateProfileSectionA("SectionName", szBuffer, _countof(szBuffer), lpszPathINI) != _countof(szBuffer)-2)
{
// Buffer size is sufficient
}
else
{
// Insufficient buffer size
}

WritePrivateProfileSection() 可以寫入 INI 某個 section 的全部內容。
若內容設成 NULL,會刪除此 section。


WritePrivateProfileSectionA("SectionName", NULL, lpszPathINI);

若內容設成 “”,會成為一個空白的 section。


WritePrivateProfileSectionA("SectionName", szBuffer, lpszPathINI);

(本頁面已被瀏覽過 141 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料