prg_env_user_home_get()
Abstract
Returns the path to the current user’s home directory.
Syntax
prg_env_user_home_get (home_dir_str)
| Argument | Type | Description |
|---|---|---|
home_dir_str |
char * |
A character array which will receive the user’s home directory. |
Return Type
PrgT_Compcode
PrgC_Compcode_Failure if the user’s home directory could not be obtained from the operating system; PrgC_Compcode_Success otherwise.
Header
prg_env.h
Example
char home_dir_str [128];
...
prg_env_user_home_get (home_dir_str);
printf ("The user's home directory is %s\n", home_dir_str);
Details
The path to the user’s home directory is obtained from the operating system (usually by fetching the value of the HOME environment variable or equivalent). Because the details vary from system to system, this function is provided as a convenience.
Purpose
The string returned by this function can be used to locate the user’s home directory for the purpose of saving user-specific data (configuration settings, etc.).
Errors
- None
Reference
- None