TutHashLookup


Name

TutHashLookup — find an entry in the hash table

Synopsis

T_PTR TutHashLookup(table, key) 
T_HASH_TABLE table; 
T_PTR key; 

Arguments

table — table where the entry should be looked for

key — the key to use to find the entry

Return Values

The entry if it was located, NULL otherwise.

Diagnostics

If TutHashLookup fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TutHashLookup returns the entry that was previously stored in table. key is used to locate the entry. If the entry is not found, a null pointer is returned. The type of key should be consistent with the key type specified when the hash table was created.

Caution

None

See Also

TutHashCreate, TutHashInsert, TutHashTraverse

Examples

This example looks up an entry in the hash table:

T_HASH_TABLE table; 
table = TutHashCreateStr(20); 
/* this will print 0 because look up will fail */ 
TutOut("look up of EAST is %d\n",  
        (T_INT4)TutHashLookup(table, "EAST")); 
/* insert a value */ 
TutHashInsert(table, "EAST", (T_PTR)1); 
/* this will print 1 *TutOut("look up of EAST is %d\n",  
        (T_INT4)TutHashLookup(table, "EAST")); 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com