# wxFileConfig Class Reference
[Application and System configuration]

`#include <wx/fileconf.h>`

Inheritance diagram for wxFileConfig:
[legend]

## Detailed Description

wxFileConfig implements wxConfigBase interface for storing and retrieving configuration information using plain text files.

The files have a simple format reminiscent of Windows INI files with lines of the form `"key = value"` defining the keys and lines of special form `"[group]"` indicating the start of each group.

This class is used by default for wxConfig on Unix platforms but may also be used explicitly if you want to use files and not the registry even under Windows.

##

Library: wxBase

Category: Application and System configuration

See also:
  wxFileConfig::Save

## Public Member Functions
| wxFileConfig (wxInputStream &is, const wxMBConv &conv=wxConvAuto())
| Read the config data from the specified stream instead of the associated file, as usual.
virtual bool | Save (wxOutputStream &os, const wxMBConv &conv=wxConvAuto())
| Saves all config data to the given stream, returns true if data was saved successfully or false on error.
void | SetUmask (int mode)
| Allows to set the mode to be used for the config file creation.
## Static Public Member Functions
static wxFileName | GetGlobalFile (const wxString &basename)
| Return the full path to the file which would be used by wxFileConfig as global, system-wide, file if it were constructed with basename as "global filename" parameter in the constructor.
static wxFileName | GetLocalFile (const wxString &basename, int style=0)
| Return the full path to the file which would be used by wxFileConfig as local, user-specific, file if it were constructed with basename as "local filename" parameter in the constructor.

List of all members.

## Constructor & Destructor Documentation

wxFileConfig::wxFileConfig | ( | wxInputStream & | is,
|  | const wxMBConv & | conv = `wxConvAuto()` |
| ) |  |  |

Read the config data from the specified stream instead of the associated file, as usual.

See also:
  Save()

## Member Function Documentation

static wxFileName wxFileConfig::GetGlobalFile | ( | const wxString & | basename | ) | `[static]`

Return the full path to the file which would be used by wxFileConfig as global, system-wide, file if it were constructed with basename as "global filename" parameter in the constructor.

Notice that this function cannot be used if basename is already a full path name.

static wxFileName wxFileConfig::GetLocalFile | ( | const wxString & | basename,
|  | int | style = `0` |
| ) |  |  | `[static]`

Return the full path to the file which would be used by wxFileConfig as local, user-specific, file if it were constructed with basename as "local filename" parameter in the constructor.

style has the same meaning as in wxConfig constructor and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is examined by this function.

Notice that this function cannot be used if basename is already a full path name.

virtual bool wxFileConfig::Save | ( | wxOutputStream & | os,
|  | const wxMBConv & | conv = `wxConvAuto()` |
| ) |  |  | `[virtual]`

Saves all config data to the given stream, returns true if data was saved successfully or false on error.

Note the interaction of this function with the internal "dirty flag": the data is saved unconditionally, i.e. even if the object is not dirty. However after saving it successfully, the dirty flag is reset so no changes will be written back to the file this object is associated with until you change its contents again.

See also:
  wxConfigBase::Flush

void wxFileConfig::SetUmask | ( | int | mode | ) |

Allows to set the mode to be used for the config file creation.

For example, to create a config file which is not readable by other users (useful if it stores some sensitive information, such as passwords), you could use `SetUmask(0077)`.

This function doesn't do anything on non-Unix platforms.

See also:
  wxCHANGE_UMASK()

|  | [ top ]