Contents Up Previous Next

Environment access functions

The functions in this section allow to access (get) or change value of environment variables in a portable way. They are currently implemented under Win32 and POSIX-like systems (Unix).

Include files

<wx/utils.h>

wxGetenv
wxGetEnv
wxSetEnv
wxUnsetEnv


wxGetenv

wxChar * wxGetEnv(const wxString& var)

This is a macro defined as getenv() or its wide char version in Unicode mode.

Note that under Win32 it may not return correct value for the variables set with wxSetEnv, use wxGetEnv function instead.


wxGetEnv

bool wxGetEnv(const wxString& var, wxString *value)

Returns the current value of the environment variable var in value. value may be NULL if you just want to know if the variable exists and are not interested in its value.

Returns true if the variable exists, false otherwise.


wxSetEnv

bool wxSetEnv(const wxString& var, const wxChar *value)

Sets the value of the environment variable var (adding it if necessary) to value.

Returns true on success.


wxUnsetEnv

bool wxUnsetEnv(const wxString& var)

Removes the variable var from the environment. wxGetEnv will return NULL after the call to this function.

Returns true on success.