okutil_read_file_section_keys
Description
Get all the key names in a section into a string array from a file.
Syntax
int okutil_read_file_section_keys( LPCSTR lpcszFilename, LPCSTR lpcszSecName, StringArray * pvsKeys, StringArray * pvsValues, StringArray * pvsComments = NULL )
Parameters
- lpcszFilename
- [input] fullpath file name
- lpcszSecName
- [input] the section name to get the key names from
- pvsKeys
- [output] all keys name
- pvsValues
- [output] value of each key
- pvsComments
- [output] comment of each value
Return
the number of keys if success, else return minus value for failure.
Examples
EX1
void okutil_write_file_section_keys_ex()
{
string strFile = "C:\junk.txt";
string strSec = "My Settings";
vector<string> vsKeys = {"Color", "Shape"};
vector<string> vsValues = {"2", "1"};
vector<string> vsComments = {"green", "circle"};
okutil_write_file_section_keys(strFile, strSec, &vsKeys, &vsValues, &vsComments);
vector<string> vsKeys2, vsValues2, vsComments2;
okutil_read_file_section_keys(strFile, strSec, &vsKeys2, &vsValues2, &vsComments2);
}
Remark
See Also
okutil_write_file_section_keys, okutil_get_file_sections
header to Included
origin.h
Reference
|