![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Read the next line of the host database file
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
struct hostent * gethostent_r( FILE ** hostf,
struct hostent * result,
char * buffer,
int buflen,
int * h_errnop );
libsocket
Use the -l socket option to qcc to link against this library.
The gethostent_r() function is a thread-safe version of the gethostent() function. This function gets the local host's entry. If the pointer pointed to by hostf is NULL, gethostent_r() opens /etc/hosts and returns its file pointer in hostf for later use. It's the calling process's responsibility to close the host file with fclose().
![]() |
The first time that you call gethostent_r(), pass NULL in the pointer pointed to by hostf. |
A pointer to result, or NULL if an error occurs.
If an error occurs, the int pointed to by h_errnop is set to:
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
endhostent(), gethostent(), sethostent()
/etc/hosts in the Utilities Reference
![]() |
![]() |
![]() |
![]() |