<raju raya> Wrote:
>
> Hi,
> I am trying very simple thing writing  a record and
> just displaying it. But the following code is not
> wokring. Can any body tell what's the problem in this
> code.
>

First of all, "this code is not working" is a bit generic...
Second, you can evaluate tools like Onboard resource editor to inspect the
contents of pdb on POSE (or real palm devices).

third: In code below

> typedef struct
> {
>       unsigned int ID;
>       const char * name;
>       const char * address;
>
> }Details;
> typedef struct
> {
>       unsigned int ID;
>       char name[1];
>
>
> }PackDetails;
>

[SNIP]

>
> static void PackDetailsRecord(VoidHand
> SampleRef,Details *x )
> {
> UInt32 length =0;
> void *p;
> unsigned long offset =0;
> length =
> sizeof(x->ID)+StrLen(x->name)+StrLen(x->address)+2;
>
> if (MemHandleResize(SampleRef,length)==0)
> {
>   p= MemHandleLock(SampleRef);
>
>   DmWrite(p, offset, &x->ID, sizeof(x->ID));
>   offset+= sizeof(x->ID);
>   DmStrCopy(p, offset, (CharPtr)& x->name);
>

why do you use the pointer to x->name if x->name is already the pointer to
the string that you need?
Why not:
        DmStrCopy(p, offset, x->name);

>
>  offset+= StrLen(x->name)+1;
>  DmStrCopy(p, offset,(CharPtr)&x->address);
>
Same as above
>
>  MemHandleUnlock(SampleRef);
> }
> }
>
[SNIP]
>

Best regards
Pietro


-- 
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