Description
Return the standard host name for the local machine.
#include <winsock.h>
int PASCAL FAR gethostname ( char FAR * name, int namelen );
name
Remarks
This routine returns the name of the local host into the buffer specified by the name parameter. The host name is returned as a null-terminated string. The form of the host name is dependent on the Windows Sockets implementation--it may be a simple host name, or it may be a fully qualified domain name. However, it is guaranteed that the name returned will be successfully parsed by gethostbyname() and WSAAsyncGetHostByName().
Return Value
If no error occurs, gethostname() reutrns 0, otherwise it returns SOCKET_ERROR and a specific error code may be retrieved by calling WSAGetLastError().
Error Codes
WSAEFAULT
See Also
gethostbyname(), WSAAsyncGetHostByName()