hsearch()

search hash table 

Function


SYNOPSIS

#include <search.h>

ENTRY *hsearch(ENTRY item, ACTION action);


DESCRIPTION

The hsearch() function is a hash-table search routine. It returns a pointer into a hash table indicating the location where an entry can be found. The comparison function used by hsearch() is strcmp().


PARAMETERS

item 

Is a structure containing two pointers:

key 

Points to the comparison key.

data 

Points to any data associated with that key.

action 

Either ENTER or FIND. When ENTER is specified, the item is inserted in the table at an appropriate point; an existing item with the same key is not overwritten. When FIND is specified, the item is not inserted into the table. When an entry exists with the specified key, it is returned, otherwise NULL is returned.


RETURN VALUES

The hsearch() function returns a null pointer if either the action is FIND and the item could not be found, or the action is ENTER and the table is full. Otherwise, a pointer to the entry matching the specified key is returned.


CONFORMANCE

UNIX 98.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

Note that only one hash table can be active in a process at any given time.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
bsearch(), hcreate(), hdestroy(), lsearch(), strcmp(), tsearch()


PTC MKS Toolkit 10.4 Documentation Build 39.