--- shailesh k phalle wrote:
> what is packing & unpacking of data

UnPacked data:
--------------

typedef struct
{
  Char first[15];
  Char last[15];
} myRecord;

example:

myRecord r;
StrCopy(r.first, "Joe");
StrCopy(r.last, "Baloney");

the result is 
Joe0***********Baloney0*******

(where * represents any char, 0 represents '\0')

Packed data:
------------

typedef struct
{
  Char *firstlast;
} myPackedRecord;

example:

myPackedRecord pr;
pr.firstlast = MemPtrNew(12);
MemMove(pr.firstlast, "Joe", 4);
MemMove(pr.firstlast+4,"Baloney", 8);

the result is 
Joe0Baloney0

The packed data takes up less space on your handheld.  But, before your
program can use it, the data must be unpacked -- separated into the two
strings, first and last.

(Apoligies in advance if there are any typos in the above, untested,
code.)


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to