INI file operation API.
More...
Go to the source code of this file.
|
| unsigned int | _GetPrivateProfileInt (const char *section, const char *key, int default_value, const char *path) |
| | Read a value from an INI file and parse it as an integer.
|
| |
| unsigned int | _GetPrivateProfileString (const char *section, const char *key, const char *default_value, char *out, size_t outsize, const char *path) |
| | Read a value from an INI file.
|
| |
| bool | _WritePrivateProfileString (const char *section, const char *key, const char *value, const char *path) |
| | Write a value to an INI file.
|
| |
INI file operation API.
The functions in this API have the same names (other than the prefixed underscore) and function signatures as their Win32 API counterpart. However some behaviors seen in the original Win32 API were missing or altered, particularly on how these functions handle NULLs. Therefore one should not treat them the same way as treating their Win32 API counterpart.
◆ _GetPrivateProfileInt()
| unsigned int _GetPrivateProfileInt |
( |
const char * |
section, |
|
|
const char * |
key, |
|
|
int |
default_value, |
|
|
const char * |
path |
|
) |
| |
|
extern |
Read a value from an INI file and parse it as an integer.
- Syscall Number
0x10110
- Parameters
-
| section | The section where the key is located. |
| key | The key. |
| default_value | The default value to be returned when the key does not exist in the INI file. |
| path | DOS 8.3 path to INI file. |
- Returns
- The value that is associated with
section.key, or default if the key does not exist.
◆ _GetPrivateProfileString()
| unsigned int _GetPrivateProfileString |
( |
const char * |
section, |
|
|
const char * |
key, |
|
|
const char * |
default_value, |
|
|
char * |
out, |
|
|
size_t |
outsize, |
|
|
const char * |
path |
|
) |
| |
|
extern |
Read a value from an INI file.
For values, the function will copy at most outsize - 1 bytes and the last byte in the out buffer will always be set to '\0'.
- Warning
- It is unsafe to use this function as not all systems check
outsize and buffer overrun is not preventable on such systems.
- Note
- The section/key listing behavior as seen in the corresponding Win32 API call is unimplemented and setting
section or key to NULL seems to only let the call fail unconditionally.
- Syscall Number
0x10111
- Parameters
-
| section | The section where the key is located. |
| key | The key. |
| default_value | The default value to be copied to out when the key does not exist in the INI file, or "" when set to NULL. |
| [out] | out | Pointer to the output buffer. |
| outsize | Maximum size of the output buffer. |
| path | DOS 8.3 path to INI file. |
- Returns
- The length of the string copied to the
out buffer.
◆ _WritePrivateProfileString()
| bool _WritePrivateProfileString |
( |
const char * |
section, |
|
|
const char * |
key, |
|
|
const char * |
value, |
|
|
const char * |
path |
|
) |
| |
|
extern |
Write a value to an INI file.
NULL in section, key or value will be interpreted as the string "<NULL>". A NULL key but not a NULL section seems to also cause the function to stop using the specified section.
- Syscall Number
0x10112
- Parameters
-
| section | The section where the key is located. |
| key | The key. |
| value | The value. |
| path | DOS 8.3 path to INI file. |
- Return values
-
| true | The operation was completed successfully. |
| false | The operation failed with error. |