mk_key
Summary
#include <dataman/dataman.h>
mk_key(k_buff,key_val,key_len);
key k_buff;
char *key_val;
int key_len;
Description
This function generates keys to be used with the get, and
remove routines. The variable k_buff is of type key.
key is a typedef in the dataman.h include file. The
argument key_val is a string representing the key to be
retrieved (or removed), and len is the length of the
string. The user may use the system defined value KEY to
generate a key as long as the length passed is KEY_LEN.
KEY is the system value of the last accessed key including
KP and MFRP. Using
this value the system can distinguish between different
occurrences of identical keys.
Example
#include <dataman/dataman.h>
main(int argc, char *argv[])
{
key k_buff;
...
mk_key(key_buff,acct_num,10); /* build key */
remove(key_buff,num_ix) else
fatal("Key does not exist: %s\n",key_buff);
...
}
Or to save the system key:
key key_buff[10]; /* declare key buff */
... /* process some more */
mk_key(key_buff[i],KEY,KEY_LEN); /* save sys key */
get(name_ix,key_buff[i]) else
...
This retrieves a particular occurrence of a key.
«previous next»