## Network, user and OS functions

The functions in this section are used to retrieve information about the current computer and/or user characteristics.

::wxGetEmailAddress
::wxGetFreeMemory
::wxGetFullHostName
::wxGetHomeDir
::wxGetHostName
::wxGetOsDescription
::wxGetOsVersion
::wxGetUserHome
::wxGetUserId
::wxGetUserName

### ::wxGetEmailAddress

wxString wxGetEmailAddress()

bool wxGetEmailAddress(char * buf, int sz)

Copies the user's email address into the supplied buffer, by concatenating the values returned by wxGetFullHostName and wxGetUserId.

Returns true if successful, false otherwise.

Include files

<wx/utils.h>

### ::wxGetFreeMemory

wxMemorySize wxGetFreeMemory()

Returns the amount of free memory in bytes under environments which support it, and -1 if not supported or failed to perform measurement.

Include files

<wx/utils.h>

### ::wxGetFullHostName

wxString wxGetFullHostName()

Returns the FQDN (fully qualified domain host name) or an empty string on error.

See also

wxGetHostName

Include files

<wx/utils.h>

### ::wxGetHomeDir

wxString wxGetHomeDir()

Return the (current) user's home directory.

See also

wxGetUserHome
wxStandardPaths

Include files

<wx/utils.h>

### ::wxGetHostName

wxString wxGetHostName()

bool wxGetHostName(char * buf, int sz)

Copies the current host machine's name into the supplied buffer. Please note that the returned name is not fully qualified, i.e. it does not include the domain name.

Under Windows or NT, this function first looks in the environment variable SYSTEM_NAME; if this is not found, the entry HostName in the wxWidgets section of the WIN.INI file is tried.

The first variant of this function returns the hostname if successful or an empty string otherwise. The second (deprecated) function returns true if successful, false otherwise.

See also

wxGetFullHostName

Include files

<wx/utils.h>

### ::wxGetOsDescription

wxString wxGetOsDescription()

Returns the string containing the description of the current platform in a user-readable form. For example, this function may return strings like `Windows NT Version 4.0` or `Linux 2.2.2 i386`.

See also

::wxGetOsVersion

Include files

<wx/utils.h>

### ::wxGetOsVersion

int wxGetOsVersion(int *major = NULL, int *minor = NULL)

Gets operating system version information.

Platform | Return types
Mac OS | Return value is wxMAC when compiled with CodeWarrior under Mac OS 8.x/9.x and Mac OS X, wxMAC_DARWIN when compiled with the Apple Developer Tools under Mac OS X. Both major and minor have to be looked at as hexadecimal numbers. So System 10.2.4 returns 0x10, resp 16 for major and 0x24, resp 36 for minor.
GTK | Return value is wxGTK, For GTK 1.0, major is 1, minor is 0.
Motif | Return value is wxMOTIF_X, major is X version, minor is X revision.
OS/2 | Return value is wxOS2_PM.
Windows 3.1 | Return value is wxWINDOWS, major is 3, minor is 1.
Windows NT/2000 | Return value is wxWINDOWS_NT, version is returned in major and minor.
Windows 98 | Return value is wxWIN95, major is 4, minor is 1 or greater.
Windows 95 | Return value is wxWIN95, major is 4, minor is 0.
Win32s (Windows 3.1) | Return value is wxWIN32S, major is 3, minor is 1.
Windows PocketPC | Return value is wxWINDOWS_POCKETPC, version is returned in major and minor.
Windows Smartphone | Return value is wxWINDOWS_SMARTPHONE, version is returned in major and minor.
Windows CE (non-specific) | Return value is wxWINDOWS_CE, version is returned in major and minor.
Watcom C++ 386 supervisor mode (Windows 3.1) | Return value is wxWIN386, major is 3, minor is 1.

See also

::wxGetOsDescription

Include files

<wx/utils.h>

### ::wxGetUserHome

const wxChar * wxGetUserHome(const wxString& user = "")

Returns the home directory for the given user. If the username is empty (default value), this function behaves like wxGetHomeDir.

Include files

<wx/utils.h>

### ::wxGetUserId

wxString wxGetUserId()

bool wxGetUserId(char * buf, int sz)

This function returns the "user id" also known as "login name" under Unix i.e. something like "jsmith". It uniquely identifies the current user (on this system).

Under Windows or NT, this function first looks in the environment variables USER and LOGNAME; if neither of these is found, the entry UserId in the wxWidgets section of the WIN.INI file is tried.

The first variant of this function returns the login name if successful or an empty string otherwise. The second (deprecated) function returns true if successful, false otherwise.

See also

wxGetUserName

Include files

<wx/utils.h>

### ::wxGetUserName

wxString wxGetUserName()

bool wxGetUserName(char * buf, int sz)

This function returns the full user name (something like "Mr. John Smith").

Under Windows or NT, this function looks for the entry UserName in the wxWidgets section of the WIN.INI file. If PenWindows is running, the entry Current in the section User of the PENWIN.INI file is used.

The first variant of this function returns the user name if successful or an empty string otherwise. The second (deprecated) function returns `true` if successful, `false` otherwise.

See also

wxGetUserId

Include files

<wx/utils.h>