GetProfileSection¶
GetProfileSection returns all keys with their values of the specified section in the form key=value.
-
svVal = GetProfileSection(ssSection, ssIniFile)
Return Value
svVal is a string vector with all keys of the given section.
The key name is followed by a =
character followed by the value.
Use strtok to split the values into key and value. In case of an error
the function returns an empty string (“”).
Parameters
-
ssSection
ssSection specifies the section containing the key name. The name of the section is case-insensitive.
-
ssIniFile
ssFileName is a string naming the initialization file.
Example
If the file d:/test.ini contains the following text
[Section]
Key=123
the call to GetProfileSection returns the string “Key=123”
svString = GetProfileSection("Section", "d:/test.ini");
if (svString[1] == "") {
error()
}
nKeys = len(svString);
smKey = strempty(nKeys, 2);
for (i in 1:nKeys) {
svKeyVal = strtok(svString[i], "=", FALSE);
smKey[i;1] = svKeyVal[1];
smKey[i;2] = svKeyVal[2];
}
id-1346108