i suggest

"Object oriented programming in C++" by Bjorn Strotustrup



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Alan
Ingleby
Sent: Tuesday, March 18, 2003 3:49 PM
To: Palm Developer Forum
Subject: Re: Writing a char* to the database


There are several faults with the code you list below.  All of them point to
a lack of understanding of some fundemental C concepts, particularly
pointers.  I would suggest you read a good C book, or a tutorial on the web.

Sorry to seem harsh, but the issues you raise are not really related to
PalmOS programming.

Alan

PS:(I've placed a few /**/ comments in the code below, to "point" you in the
right direction...)


"Blackwell Chris A Maj CENTAF-PSAB/C3 TCT Attack Coordinator"
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>
> Simple question...
>
> I want a dynamic List box that I get entries for from a database. From
> memory...
>
> the database struct is
>
> struct dbstructType {
> int ref;
> char* text; /* This is a pointer. You can't store a pointer in a database,
as the data it is pointing to is likely to have moved by the time you recall
the database record.  You need to store a Char ARRAY in the database. ie:
Char text[32];, and StrCopy the data there.*/
> } *curRec;
>
> The input to add into the text  is a text field:
>
> curRec->text=FldGetTextPtr(...);
>
> 1. is that the right way to code that?
> 2. When I write:
>
> MemHandle hMem=DmNewRecord(gDBListBoxH,&position,sizeof(curRec)); /* If
"curRec" is a pointer, sizeof(curRec) returns 4 */
> MemPtr p=MemHandleLock(hMem);
> DmWrite(p,0,&curRec, sizeof(curRec))  /* "curRec" is a pointer.  You are
passing the address of (&) the pointer to this function.*/
> MemPtrUnlock(...)



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


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

Reply via email to