Your structure uses char pointers.  You can't do that and load/unload the
structure directly into the PDB.  You're only saving the address of the
Char* in the PDB file which will become invalid as soon as you release the
memory they use.
If you plan to load/unload the structure directly, try:
> > typedef struct MLSDB
> > {
> >   Char date[MAXDATESIZE];    /* Date of Game/Event */
> >   Char away[MAXAWAYSIZE];    /* Away team name, 51 characters allowed */
> >   Char home[MAXAHOMETEAMSIZE];    /* Home team name, 51 characters
allowed */
> >   Char time[MAXTIMESIZE];    /* Time of Game/Event */
> >   Char TV[MAXSTATIONSIZE];    /* TV Station of Game, 51 characters
allowed */
> >   Char results[MAXRESULTSSIZE];    /* Results of Game, 51 characters
allowed */
> >   Char attendence[MAXATTENDENCESIZE];    /* Attendence of Game, 51
characters allowed */
> >   } MLSDB;


----- Original Message -----
From: "Kade P. Cole" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 11:13 AM
Subject: Re: Palm PDB Database Help


>
> I must not have explained it well. The Databse record in the PDB DOES
> contain the character strings. The struct that I am using to access the DB
> record is the one with the pointers in it.
>
> Kade
>
>
> On 4/2/02 9:51 AM, "Robert McKenzie" <[EMAIL PROTECTED]>
wrote:
>
> > Kade:
> >
> > You have a basic C misconception here.
> >
> > A DB record should (can only) contain that actual strings themselves,
NOT
> > pointers to them.
> >
> > -bob mckenzie, palmsource pdx.
> >
> > -----Original Message-----
> > From: Kade P. Cole [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, April 02, 2002 7:35 AM
> > To: Palm Developer Forum
> > Subject: Palm PDB Database Help
> >
> >
> >
> > I am trying to write my first Palm application. I am having some trouble
> > with reading values from a PDB file I created from a database. I have 7
> > Fields and they are all character strings in the database. Every time I
try
> > and read one I get a bad memory reference error.  I am getting the
memory
> > address of the record into a MemHandle variable. Then I am setting the
> > memory reference = my struct for a database entry. My struct looks like
> > this:
> >
> > typedef struct MLSDB
> > {
> >   Char* date;    /* Date of Game/Event */
> >   Char* away;    /* Away team name, 51 characters allowed */
> >   Char* home;    /* Home team name, 51 characters allowed */
> >   Char* time;    /* Time of Game/Event */
> >   Char* TV;    /* TV Station of Game, 51 characters allowed */
> >   Char* results;    /* Results of Game, 51 characters allowed */
> >   Char* attendence;    /* Attendence of Game, 51 characters allowed */
> >   } MLSDB;
> >
> >
> > The problem is that I can not figure out how to compute the StrLen or
length
> > of the character strings in the database so I can initialize the struct
> > members to the correct sizes. Can anyone out there help me with this?
Thanks
> > for your time. Please let me know if I need to post more info.
> >
> > Thanks,
> >
> > Kade P. Cole
> > [EMAIL PROTECTED]
> >
>
>
> --
> 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