|
高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】oddbobjectid to charin
oddbobjectid to char/int ..
oddbobjectid to char/int ..
hi,
i need to get oddbobjectid in terms of int or char.
is it possible to get that?
basically i am trying to get unique character/integer value for each entity, so could you please help me out??
thanks in advance.
would using an oddbhandle work for you?
i use the following code to get the object id based on the handle:
code:
void getobjectid(char *ahandle)
{
oddbhandle objhandle(ahandle);
oddbobjectid objid = pdb->getoddbobjectid(objhandle);
}you can see that i am using handles to retrieve the object ids. i read somewhere that handles are unique in the database. if you have a better way i would also like to know about it.
to get the handle i use:
code:
#define handle_size 20
void gethandle(char **ahandle)
{
// add entity
...
// allocate memory for handle
(*ahandle) = (char *) malloc(handle_size * sizeof(char));
oddbhandle objhandle = pobj->getdbhandle();
odchar odhandle[handle_size];
objhandle.getintoasciibuffer(odhandle);
for (int j = 0; j < handle_size; j++)
(*ahandle)[j] = (char) odhandle[j];
|