# IupConfigLoad

Definition: | include pGUI.e integer errcode = IupConfigLoad(Ihandle config)
Description: | Loads the configuration file. config: Identifier of the configuration database (see IupConfig) Returns an error code: 0 = no error; -1 = error opening the file; -2 = error accessing the file; -3 = error during filename construction NOTE: A new application should expect to get an error code of -1, before IupConfigSave() has ever been called to actually create the new config file.
pwa/p2js: | Not supported.
Notes: | The filename (with path) can be set using a regular attribute called APP_FILENAME. More interestingly, and more portable, is to let the filename be dynamically constructed using the APP_NAME attribute. In this case APP_FILENAME must not be defined. The file names created depend on the operating system. There are two defined usages. First, a User Configuration File is stored in the user Home folder. Second, an Application Configuration File is stored in the same folder of the executable. The User Configuration File is the most common usage, simply leave the attribute APP_CONFIG set to the default of No. On Linux, the filename will be `<HOME>/.<APP_NAME>`, where <HOME> is replaced by the `HOME` environment variable contents, and <APP_NAME> is replaced by the APP_NAME attribute value. On Windows, the filename will be `<HOMEDRIVE><HOMEPATH>\<APP_NAME>.cfg`, where HOMEDRIVE and HOMEPATH are also obtained from environment variables. If the attribute APP_SYSTEMPATH is set to Yes, then it will use the system defined folder for application files (since 3.28), in Windows will be the same folder given by the environment variables with `Application Data\` or `AppData\Roaming\` appended. The Application Configuration File is defined by setting the attribute APP_CONFIG to Yes (default is No), and in this case the attribute APP_PATH must also be set. On UNIX, the filename will be `<APP_PATH>.<APP_NAME>`, and on Windows it will be `<APP_PATH><APP_NAME>.cfg`. Notice that the attribute APP_PATH must contain a folder separator (`/` or `\`, either will work on any platform) at the end. After the IupConfigLoad function is called the attribute FILENAME is set (on ih) reflecting the constructed filename. As a developer it is usually quite instructive to view the contents of that file, especially during testing and debugging.
Attributes: | APP_FILENAME, APP_NAME, APP_CONFIG, APP_PATH, FILENAME, <GROUP>.<KEY> as per Notes just above
Example: | An application usually performs something like the following at start up:
    Ihandle config = IupConfig()
    IupSetAttribute(config, "APP_NAME", "MyAppName")
    {} = IupConfigLoad(config)
See Also: | IupConfig, IupConfigSave