I want to have a integer value to my "key.data" in Berkeley DB. Since we use DBT structures in Berkley DB,and it has "A pointer to a byte string", I created a structure for key with a memeber int. But now I am facing problem in accessing the value stored inside structure. Below is my code:
struct pearson_key{
int k;
};
struct pearson_key keyStruct;
DBT key
memset(&key, 0, sizeof(key));
memset(&keyStruct, 0, sizeof(struct pearson_key));
int k = 1;
keyStruct.k = k;
key.data = &keyStruct;
printf("value = %s",(char*)keyStruct);
key.size = sizeof(keyStruct);
It is printing blank value. I am new to C and structures. I know I am somewhere wrong with structures, but don't know how to rectify it. Thanks in advance.