get_private_profile_string


template <class character>
unsigned get_private_profile_string(const character* section,
                                    const character* key_name,
                                    const character* default_value,
                                    character* string,
                                    unsigned size,
                                    const character* Filename)

This function obtains a string stored under a key in a private profile.

Parameters

const character* section

A pointer to a string naming the section under which the key is stored. If null is specified, all section names in the profile are copied to the buffer.

const character* key_name

A pointer to a string naming the key whose value is being sought. If null is specified, all key names for the given section are copied to the output buffer; where, each string is null-terminated, with the final string being terminated by a double null.

const character* default_value

A pointer to a default string. If the specified key cannot be found, the default string is copied to the output buffer. This parameter cannot be null.

character* string

A pointer to a buffer to hold the output string.

unsigned size

The size (in characters) of the buffer provided by the previous parameter.

const character* file_name

A pointer to a string naming the profile from which information is being retrieved.

Return

unsigned

The number of characters copied to the buffer, not including the null terminating character.

If neither Section nor Keyname is null and the supplied destination buffer is too small to hold the string, the string is truncated and null-terminated and the value returned is equal to size minus one.

If either Section or Keyname is null and the destination buffer is too small to hold all the strings, the last string is truncated and followed by two null characters. In this case, the value returned is equal to size minus two.

Notes

If the string associated with the specified key name is enclosed within single or double quotation marks, the marks are discarded in the returned string.

This function is not case-sensitive; the strings can contain a combination of uppercase and lowercase letters.

A section of a profile must have the following form:

[section]
key=value
.
.
.

Profile functions are mapped to the registry under the full operating system definition.