unsigned char * problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sansknowledge
    New Member
    • Jun 2008
    • 2

    unsigned char * problem

    hello all
    i am new to this forum, i have some knowledge in c++. I am developing a win32 dll using vc++ 6.0 in winxp sp2 using a third party SDK my problem is
    the sdk is having a few structures
    1)
    Code:
    typedef struct SKYETEK_ID 
    {
        unsigned char   *id;
        unsigned int    length;
    } SKYETEK_ID, *LPSKYETEK_ID;
    2)
    Code:
    typedef struct SKYETEK_TAG 
    {
      SKYETEK_TAGTYPE     type;
      LPSKYETEK_ID        id;
      unsigned short      afi;
      unsigned short      session;
      unsigned char       rf;
      TCHAR                friendly[128];
      void                *user;
      void                *internal;
    } SKYETEK_TAG, *LPSKYETEK_TAG;
    3)
    Code:
    unsigned char SelectLoopCallBack(LPSKYETEK_TAG lpTag, void *user)
    {
    	char* tid;
    	unsigned char *ttype;
    	if( !isStop )
    	{
    		if (lpTag!=NULL)
    			{
    			
    			tid=(SkyeTek_GetTagTypeNameFromType(lpTag->type));
    			ttype=lpTag->id; 
    			MessageBox(0,ttype,"test",0);
    
    			USES_CONVERSION;
    			MyTagid =A2BSTR(tid);
    			MyTagType=A2BSTR(ttype); 
    			SkyeTek_FreeTag(lpTag);
    
    			}
    	}
    	
    return isStop;
    }
    in the third function i am calling the second structure as lpTag.
    i want the tag id which is pointing to another structure with unsigned char* as data type.
    so i created a local unsigned char* variable and try to store the lptag->id value into it. what returns is some thing gibberish.how get the correct value from the structure and store it in a char * any help will be greatly appreciated.tha nks and regards
  • leejwen
    New Member
    • Jun 2007
    • 50

    #2
    I guess you didnt allocate memory for your "unsingned char * id"

    Comment

    • sansknowledge
      New Member
      • Jun 2008
      • 2

      #3
      how to do that ? (a bit naive)

      Comment

      Working...