Hi,

I have a structure which one of its members is a structure.
I use the DmWrite to write the structure and the rest to the storage memory.
But when I unpacked the structure, I have memory access error.
What wrong have I done? Thank you in advance.

/****************************************************************/
typedef struct{

                TimeType startTime;
                TimeType endTime;

}ApptTimeType;


typedef struct{

                ApptTimeType *when;

                Int16 dayOfWeek;
                Char *moduleName;
                Char *classRoom;
                Char *blockNo;
                Char *levelNo;

}ApptDBRecordType;

typedef ApptDBRecordType * ApptDBRecordPtr;


static void ApptPacked(ApptDBRecordPtr s, ApptDBRecordPtr d)
{
        ApptTimeType when;

        Int32 offset = 0;

        when = *(s->when);

        DmWrite(d, offset, &when, sizeof(ApptTimeType));
        offset += sizeof (ApptTimeType);






static void ApptUnpacked(ApptDBRecordPtr src, ApptDBRecordPtr dest)
{
        Char str[20];
        ApptDBRecordType ApptRead;

        ApptRead = *src;

        dest->when = ApptRead.when;
        dest->dayOfWeek = ApptRead.dayOfWeek;


        TimeToAscii(when.startTime.hours,                                              
         when.startTime.minutes,
                                        false,str);
        PrintString(str);


Low Pui Kuen

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.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