If this is the code in your application, you have a problem with the
declaration of your vars.
1 - you declare rec has Char*
2 - you declare rec has StudentRecord (in the loop)
=> No problem, the second declaration will overwrite the first one.
Error: you CANNOT declare StudentRecord *rec AFTER setting RecordHa.
Unless you are doing C++. You have to declare the var at the beginiing
of the block, and affect it later.
Ludovic
Lauren B. Robert wrote:
> Hi All, I'm having a small problem here, hope somebody can tell me what's wrong. I
>have a database that contains several records, which all share the same struct.
>
> typedef struct {
> Int32 ID;
> const char *Class;
> const char *Name;
> const char Gender;
> } StudentRecord;
>
> Hence, I did the following codes to display only the names on a dynamic list.
>
> MemHandle RecordHa;
> UInt16 indx, NumRecor;
> char *RecordPointr;
> Char *rec;
>
> for (indx=0; indx < NumRecor; indx++)
> {
> RecordHa = DmQueryRecord(MyDB, indx);
> StudentRecord *rec = (StudentRecord *) MemHandleLock(RecordHa);//Error1
> RecordPointr = rec->Name + StrLen(rec->Name) + 1;//Error2
> MemHandleUnlock(RecordHa);
> }
>
> When I compile, I had 2 errors as show above. Error1 says: expression syntax error
>StudentRecord. Error2 says: not a struct/union/class rec->Name. I don't know what's
>actually is wrong, can somebody help me please?
>
> Many Thanks
> Regards,
> Lauren
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/