Using map in Aerospike's c client

map

#1

I’m struggling in using as_map. I tried using as_map in the following way in my c++ program:

as_map test_map;
as_string s1;

char * ts1=new char[10];
memset(ts1,0,10);
strncpy(ts1,"hdfc",10);

as_string_init(&s1, ts1, false);

as_string s2;
char * ts2=new char[10];
memset(ts2,0,10);
strncpy(ts2,"5010010",10);

as_string_init(&s2, ts2, false);

as_val* vs1= as_string_toval(&s1);
as_val* vs2=as_string_toval(&s2);

int l_status=as_map_set(map_p,vs1,vs2);

cout<<endl<<"status: "<<l_status<<endl;

But I’m getting segmentation fault when I’m calling ‘as_map_set’. What exactly am I doing wrong? Please help.


#2

Look at examples in the C Client. https://github.com/aerospike/aerospike-client-c/blob/master/examples/basic_examples/map/src/main/example.c


#3

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.