wxWidgets: Network, User and OS

| Version: 3.0.4

Functions
Network, User and OS
Functions and Macros by Category

## Detailed Description

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

Related class group: Networking, wxPlatformInfo.

## Functions
wxString | wxGetEmailAddress ()
| Copies the user's email address into the supplied buffer, by concatenating the values returned by wxGetFullHostName() and wxGetUserId(). More...
bool | wxGetEmailAddress (char *buf, int sz)
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. More...
wxString | wxGetHomeDir ()
| Return the (current) user's home directory. More...
wxString | wxGetHostName ()
| Copies the current host machine's name into the supplied buffer. More...
bool | wxGetHostName (char *buf, int sz)
wxString | wxGetFullHostName ()
| Returns the FQDN (fully qualified domain host name) or an empty string on error. More...
wxString | wxGetUserHome (const wxString &user=wxEmptyString)
| Returns the home directory for the given user. More...
wxString | wxGetUserId ()
| This function returns the "user id" also known as "login name" under Unix (i.e. More...
bool | wxGetUserId (char *buf, int sz)
wxString | wxGetUserName ()
| This function returns the full user name (something like "Mr. John Smith"). More...
bool | wxGetUserName (char *buf, int sz)
wxString | wxGetOsDescription ()
| Returns the string containing the description of the current platform in a user-readable form. More...
wxOperatingSystemId | wxGetOsVersion (int *major=NULL, int *minor=NULL)
| Gets the version and the operating system ID for currently running OS. More...
bool | wxIsPlatform64Bit ()
| Returns true if the operating system the program is running under is 64 bit. More...
bool | wxIsPlatformLittleEndian ()
| Returns true if the current platform is little endian (instead of big endian). More...
wxLinuxDistributionInfo | wxGetLinuxDistributionInfo ()
| Returns a structure containing information about the currently running Linux distribution. More...

## Function Documentation

## ◆ wxGetEmailAddress() [1/2]

wxString wxGetEmailAddress | ( |  | ) |

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 file:

    #include <wx/utils.h>

## ◆ wxGetEmailAddress() [2/2]

bool wxGetEmailAddress | ( | char * | buf,
|  | int | sz
| ) |  |

Deprecated:
  Use wxGetEmailAddress() instead.

Parameters

  buf | Buffer to store the email address in.
  sz | Size of the buffer.

Returns
  true if successful, false otherwise.

Include file:

    #include <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 file:

    #include <wx/utils.h>

## ◆ wxGetFullHostName()

wxString wxGetFullHostName | ( |  | ) |

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

See also
  wxGetHostName()

Include file:

    #include <wx/utils.h>

## ◆ wxGetHomeDir()

wxString wxGetHomeDir | ( |  | ) |

Return the (current) user's home directory.

See also
  wxGetUserHome(), wxStandardPaths

Include file:

    #include <wx/utils.h>

## ◆ wxGetHostName() [1/2]

wxString wxGetHostName | ( |  | ) |

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.

Returns
  The hostname if successful or an empty string otherwise.

See also
  wxGetFullHostName()

Include file:

    #include <wx/utils.h>

## ◆ wxGetHostName() [2/2]

bool wxGetHostName | ( | char * | buf,
|  | int | sz
| ) |  |

Deprecated:
  Use wxGetHostName() instead.

Parameters

  buf | Buffer to store the host name in.
  sz | Size of the buffer.

Returns
  true if successful, false otherwise.

Include file:

    #include <wx/utils.h>

## ◆ wxGetLinuxDistributionInfo()

wxLinuxDistributionInfo wxGetLinuxDistributionInfo | ( |  | ) |

Returns a structure containing information about the currently running Linux distribution.

This function uses the `lsb_release` utility which is part of the `Linux Standard Base Core` specification (see http://refspecs.linux-foundation.org/lsb.shtml) since the very first LSB release 1.0 (released in 2001). The `lsb_release` utility is very common on modern Linux distributions but in case it's not available, then this function will return a wxLinuxDistributionInfo structure containing empty strings.

This function is Linux-specific and is only available when the `LINUX` symbol is defined.

## ◆ 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 file:

    #include <wx/utils.h>

## ◆ wxGetOsVersion()

wxOperatingSystemId wxGetOsVersion | ( | int * | major = `NULL`,
|  | int * | minor = `NULL`
| ) |  |

Gets the version and the operating system ID for currently running OS.

The returned wxOperatingSystemId value can be used for a basic categorization of the OS family; the major and minor version numbers allows to detect a specific system.

For Unix-like systems (`wxOS_UNIX`) the major and minor version integers will contain the kernel major and minor version numbers (as returned by the 'uname -r' command); e.g. "2" and "6" if the machine is using kernel 2.6.19.

For Mac OS X systems (`wxOS_MAC`) the major and minor version integers are the natural version numbers associated with the OS; e.g. "10" and "6" if the machine is using Mac OS X Snow Leopard.

For Windows-like systems (`wxOS_WINDOWS`) the major and minor version integers will contain the following values:

Windows OS name | Major version | Minor version
Windows 7 | 6 | 1
Windows Server 2008 R2 | 6 | 1
Windows Server 2008 | 6 | 0
Windows Vista | 6 | 0
Windows Server 2003 R2 | 5 | 2
Windows Server 2003 | 5 | 2
Windows XP | 5 | 1
Windows 2000 | 5 | 0

See the MSDN for more info about the values above.

See also
  wxGetOsDescription(), wxPlatformInfo

Include file:

    #include <wx/utils.h>

## ◆ wxGetUserHome()

wxString wxGetUserHome | ( | const wxString & | user = `wxEmptyString` | ) |

Returns the home directory for the given user.

If the user is empty (default value), this function behaves like wxGetHomeDir() (i.e. returns the current user home directory).

If the home directory couldn't be determined, an empty string is returned.

Include file:

    #include <wx/utils.h>

## ◆ wxGetUserId() [1/2]

wxString wxGetUserId | ( |  | ) |

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.

Returns
  The login name if successful or an empty string otherwise.

See also
  wxGetUserName()

Include file:

    #include <wx/utils.h>

## ◆ wxGetUserId() [2/2]

bool wxGetUserId | ( | char * | buf,
|  | int | sz
| ) |  |

Deprecated:
  Use wxGetUserId() instead.

Parameters

  buf | Buffer to store the login name in.
  sz | Size of the buffer.

Returns
  true if successful, false otherwise.

Include file:

    #include <wx/utils.h>

## ◆ wxGetUserName() [1/2]

wxString wxGetUserName | ( |  | ) |

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.

Returns
  The full user name if successful or an empty string otherwise.

See also
  wxGetUserId()

Include file:

    #include <wx/utils.h>

## ◆ wxGetUserName() [2/2]

bool wxGetUserName | ( | char * | buf,
|  | int | sz
| ) |  |

Deprecated:
  Use wxGetUserName() instead.

Parameters

  buf | Buffer to store the full user name in.
  sz | Size of the buffer.

Returns
  true if successful, false otherwise.

Include file:

    #include <wx/utils.h>

## ◆ wxIsPlatform64Bit()

bool wxIsPlatform64Bit | ( |  | ) |

Returns true if the operating system the program is running under is 64 bit.

The check is performed at run-time and may differ from the value available at compile-time (at compile-time you can just check if `sizeof(void*) == 8`) since the program could be running in emulation mode or in a mixed 32/64 bit system (bi-architecture operating system).

Note
  This function is not 100% reliable on some systems given the fact that there isn't always a standard way to do a reliable check on the OS architecture.

Include file:

    #include <wx/utils.h>

## ◆ wxIsPlatformLittleEndian()

bool wxIsPlatformLittleEndian | ( |  | ) |

Returns true if the current platform is little endian (instead of big endian).

The check is performed at run-time.

See also
  Byte Order Functions and Macros

Include file:

    #include <wx/utils.h>