The getprotoent() call returns a pointer to the next entry in the ETC\PROTOCOL file.
Syntax
#include <netdb.h> struct protoent *getprotoent()
Description
This call searches for the next entry in the ETC\PROTOCOL file.
The getprotoent() call retrieves the protocol information from the ETC\PROTOCOL file. An application program can use this call to access a protocol name, its aliases, and protocol number.
The getprotoent() call opens and performs a sequential read of the ETC\PROTOCOL file. The getprotoent() call returns a pointer to a protoent structure, which contains fields for a line of information in the ETC\PROTOCOL file. The protoent structure is defined in the <NETDB.H> file.
Use the endprotoent() call to close the ETC\PROTOCOL file.
Return Values
The getprotoent() call returns a pointer to the next entry in the file, ETC\PROTOCOL. The return value points to static data that subsequent API calls can modify. A pointer to a protoent structure indicates success. A NULL pointer indicates an error or EOF.
The protoent structure is defined in the <NETDB.H> header file and contains the following elements:
Element
Related Calls