getnetbyname()

The getnetbyname() call returns a pointer to the ETC\NETWORKS file entry that contains the specified network name.

Syntax

#include <netdb.h>
struct netent *getnetbyname(name)
char *name;

Parameters

name

Description

This call searches the ETC\NETWORKS file for the specified network name.

The getnetbyname() call retrieves information from the ETC\NETWORKS file using the name parameter as a search key. The getnetbyname() call searches the file sequentially from the start of the file until it encounters a matching net name or until it reaches the end of the file.

The getnetbyname() call returns a pointer to a netent structure, which contains the equivalent fields for a network description line in the ETC\NETWORKS file. The netent structure is defined in the <NETDB.H> file.

Use the endnetent() call to close the ETC\NETWORKS file.

Return Values

The getnetbyname() call returns a pointer to a netent structure for the network name specified on the call. The return value points to static data that subsequent API calls can modify. A pointer to a netent structure indicates success. A NULL pointer indicates an error or EOF.

The netent structure is defined in the <NETDB.H> header file and contains the following elements:

Element

n _ name n _ aliases n _ addrtype n _ net

Related Calls


[Back: getnetbyaddr()]
[Next: getnetent()]