HashTableGetItem
int HashTableGetItem (HashTableType table, const void *key, void *value, size_t valueBufferSize);
Purpose
Returns the value associated with a key.
If there is no value associated with the key, HashTableGetItem returns 0 for the value parameter and the function returns success.
To get the value size, pass a buffer size of 0.
Example Code
{
HashTableType table;
int key = 1;
unsigned int size;
unsigned char *buffer;
/* ... */
size = HashTableGetItem(table, &key, NULL, 0);
buffer = malloc(size);
HashTableGetItem(table, &key, buffer, size);
}
Parameters
Input | ||
Name | Type | Description |
table | HashTableType | Hash table from which to get the item. |
key | const void * |
Pointer to the first byte of the key data. |
valueBufferSize | size_t |
The size, in bytes, of the value buffer. The function returns an error if the buffer is not large enough to hold the value. Pass 0 to have the function return the necessary buffer size. {
HashTableType table; } |
Output | ||
Name | Type | Description |
value | void * |
A buffer or variable reference in which to store the value associated with the key. |
Return Value
Name | Type | Description |
status | int |
Returns a value indicating if the function was successful.
A negative number means an error occurred. If you pass 0 for bufferSize, HashTableGetItem returns the valueSize you passed to HashTableCreate. For a detailed error message, pass the returned value to GetGeneralErrorString. |
Additional Information
Library: Programmer's Toolbox
Include file: toolbox\toolbox.h
LabWindows/CVI compatibility: LabWindows/CVI 8.5 and later