Environment
[Functions and Macros by Category]


Detailed Description

These functions allow access to get or change the values of environment variables in a portable way.

They are currently implemented under Win32 and POSIX-like systems (Unix).

Remember that these functions add/change/delete environment variables of the current process only. Child processes copy the environment variables of the parent but do not share them (a wxSetEnv() in the parent process won't change the value returned by wxGetEnv() in the child process and viceversa).

For more evoluted interprocess communication tecniques see Interprocess Communication.

Functions

wxCharwxGetenv (const wxString &var)
 This is a macro defined as getenv() or its wide char version in Unicode mode.
bool wxGetEnv (const wxString &var, wxString *value)
 Returns the current value of the environment variable var in value.
bool wxSetEnv (const wxString &var, const wxString &value)
 Sets the value of the environment variable var (adding it if necessary) to value.
bool wxUnsetEnv (const wxString &var)
 Removes the variable var from the environment.


Function Documentation

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.

Include file:

#include <wx/utils.h> 

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.

Include file:

#include <wx/utils.h> 

bool wxSetEnv ( const wxString var,
const wxString value 
)

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

Returns true on success.

See also:
wxUnsetEnv()
Include file:
#include <wx/utils.h> 

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.

Include file:

#include <wx/utils.h> 



wxWidgets logo

[ top ]