SimpleIni 4.3
Sponsored Links
SimpleIni 4.3 Ranking & Summary
File size:
0.041 MB
Platform:
Any Platform
License:
MIT/X Consortium License
Price:
Downloads:
847
Date added:
2007-07-05
Publisher:
Brodie
SimpleIni 4.3 description
SimpleIni is a cross-platform library that provides a simple API to read and write INI-style configuration files. It supports data files in ASCII, MBCS and Unicode.
It is designed explicitly to be portable to any platform and has been tested on Windows and Linux. Released as open-source and free using the MIT licence.
Examples:
These snippets are included with the distribution in the file snippets.cpp.
LOADING DATA
load from a data file
CSimpleIniA ini(a_bIsUtf8, a_bUseMultiKey, a_bUseMultiLine);
SI_Error rc = ini.LoadFile(a_pszFile);
if (rc < 0) return false;
load from a string
std::string strData;
rc = ini.Load(strData.c_str(), strData.size());
if (rc < 0) return false;
GETTING SECTIONS AND KEYS
get all sections
CSimpleIniA::TNamesDepend sections;
ini.GetAllSections(sections);
get all keys in a section
CSimpleIniA::TNamesDepend keys;
ini.GetAllKeys("section-name", keys);
GETTING VALUES
get the value of a key
const char * pszValue = ini.GetValue("section-name",
"key-name", NULL /*default*/);
get the value of a key which may have multiple values. If bHasMultipleValues is true, then just one value has been returned
bool bHasMultipleValues;
pszValue = ini.GetValue("section-name", "key-name",
NULL /*default*/, &bHasMultipleValues);
get all values of a key with multiple values
CSimpleIniA::TNamesDepend values;
ini.GetAllValues("section-name", "key-name", values);
sort the values into the original load order
values.sort(CSimpleIniA::Entry::LoadOrder());
output all of the items
CSimpleIniA::TNamesDepend::const_iterator i;
for (i = values.begin(); i != values.end(); ++i) {
printf("key-name = %sn", i->pItem);
}
MODIFYING DATA
adding a new section
rc = ini.SetValue("new-section", NULL, NULL);
if (rc < 0) return false;
printf("section: %sn", rc == SI_INSERTED ?
"inserted" : "updated");
adding a new key ("new-section" will be added automatically if it doesnt already exist)
rc = ini.SetValue("new-section", "new-key", "value");
if (rc < 0) return false;
printf("key: %sn", rc == SI_INSERTED ?
"inserted" : "updated");
changing the value of a key
rc = ini.SetValue("section", "key", "updated-value");
if (rc < 0) return false;
printf("key: %sn", rc == SI_INSERTED ?
"inserted" : "updated");
DELETING DATA
deleting a key from a section. Optionally the entire section may be deleted if it is now empty.
ini.Delete("section-name", "key-name",
true /*delete the section if empty*/);
deleting an entire section and all keys in it
ini.Delete("section-name", NULL);
SAVING DATA
save the data to a string
rc = ini.Save(strData);
if (rc < 0) return false;
save the data back to the file
rc = ini.SaveFile(a_pszFile);
if (rc < 0) return false;
Enhancements:
- Fixed a bug causing multi-line values and comments to get corrupted. This affects only files with CR LF line endings (Windows) and wchar_t/ICU interface (Unicode).
It is designed explicitly to be portable to any platform and has been tested on Windows and Linux. Released as open-source and free using the MIT licence.
Examples:
These snippets are included with the distribution in the file snippets.cpp.
LOADING DATA
load from a data file
CSimpleIniA ini(a_bIsUtf8, a_bUseMultiKey, a_bUseMultiLine);
SI_Error rc = ini.LoadFile(a_pszFile);
if (rc < 0) return false;
load from a string
std::string strData;
rc = ini.Load(strData.c_str(), strData.size());
if (rc < 0) return false;
GETTING SECTIONS AND KEYS
get all sections
CSimpleIniA::TNamesDepend sections;
ini.GetAllSections(sections);
get all keys in a section
CSimpleIniA::TNamesDepend keys;
ini.GetAllKeys("section-name", keys);
GETTING VALUES
get the value of a key
const char * pszValue = ini.GetValue("section-name",
"key-name", NULL /*default*/);
get the value of a key which may have multiple values. If bHasMultipleValues is true, then just one value has been returned
bool bHasMultipleValues;
pszValue = ini.GetValue("section-name", "key-name",
NULL /*default*/, &bHasMultipleValues);
get all values of a key with multiple values
CSimpleIniA::TNamesDepend values;
ini.GetAllValues("section-name", "key-name", values);
sort the values into the original load order
values.sort(CSimpleIniA::Entry::LoadOrder());
output all of the items
CSimpleIniA::TNamesDepend::const_iterator i;
for (i = values.begin(); i != values.end(); ++i) {
printf("key-name = %sn", i->pItem);
}
MODIFYING DATA
adding a new section
rc = ini.SetValue("new-section", NULL, NULL);
if (rc < 0) return false;
printf("section: %sn", rc == SI_INSERTED ?
"inserted" : "updated");
adding a new key ("new-section" will be added automatically if it doesnt already exist)
rc = ini.SetValue("new-section", "new-key", "value");
if (rc < 0) return false;
printf("key: %sn", rc == SI_INSERTED ?
"inserted" : "updated");
changing the value of a key
rc = ini.SetValue("section", "key", "updated-value");
if (rc < 0) return false;
printf("key: %sn", rc == SI_INSERTED ?
"inserted" : "updated");
DELETING DATA
deleting a key from a section. Optionally the entire section may be deleted if it is now empty.
ini.Delete("section-name", "key-name",
true /*delete the section if empty*/);
deleting an entire section and all keys in it
ini.Delete("section-name", NULL);
SAVING DATA
save the data to a string
rc = ini.Save(strData);
if (rc < 0) return false;
save the data back to the file
rc = ini.SaveFile(a_pszFile);
if (rc < 0) return false;
Enhancements:
- Fixed a bug causing multi-line values and comments to get corrupted. This affects only files with CR LF line endings (Windows) and wchar_t/ICU interface (Unicode).
SimpleIni 4.3 Screenshot
SimpleIni 4.3 Keywords
SimpleIni
NULL
SI
TNamesDepend
INI
SimpleIni 4.3
to read and write
read and write
to read
Simple API
cross-platform library
Configuration files
rc
false
0
return
Bookmark SimpleIni 4.3
SimpleIni 4.3 Copyright
WareSeeker periodically updates pricing and software information of SimpleIni 4.3 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of SimpleIni 4.3 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
learning to read and write
how to read and write in japanese
spell to read and write
teaching children to read and write
learn to read and write
sing spell read and write
read and write gold
read and write ntfs on mac
read and write leappad
read and write korean
read and write software
simpleinit
sing spell read and write curriculum
read and write gold software
read/write lock pattern
read and write gold 8.1
frederick douglass learning to read and write
returning to work
Related Software
mcplay is not just another fontend for mpg123. Free Download
libZI is a library that allows developers to store configuration information into an xml-file. Free Download
The DLini library provides functions for reading and writing Windows style .ini files. Free Download
mp3dup looks for duplicate files in recursively searched directories. Free Download
SegyPY includes M-files to read and write SEG-Y files from Python. Free Download
HaXml is a collection of utilities for parsing, filtering, transforming, and generating XML documents using Haskell. Free Download
pxlib is a simple and small C library for reading and writing Paradox DB files. Free Download
Tiled is a general purpose tile map editor. Free Download
Latest Software
Popular Software
Favourite Software