Thank you !

Its all good to go now...

Damn, I don't know what I would do without this newsgroup ...

Thanx again to both of you.

Jim



"David Vediner" <[EMAIL PROTECTED]> wrote in message
news:44427@palm-dev-forum...

> MemPtr RecP;
> MemHandle RecH

> RecP = MemHandleLock(RecH);
> // attempt to get pointer to beginning of strings.
> RecP += (sizeof(MyRecType) + 1);

> I also tried casting the pointer to a char* like:
> RecP =  (char*) MemHandleLock(RecH);

This last line is wrong (in conjunction with the declaration) - the
location
of this last cast says "whatever is returned by MemHandleLock(), cast as
a
char *", but you're then immediately assigning it to a void * (RecP).  I
usually just declare my record pointer as type Char * and then cast it
as
that from MemHandleLock(), i.e.:

...
Char *RecP;  // note the type

RecP = (Char *) MemHandleLock( ... );

// liberal utilization of string functions with no casts
...

I do this because I subsequently use a lot of Str...() functions, all of
which need
a Char *, not a void *, and this way leads to a lot fewer casts.  I'm
also using
C++, which is stricter about the types.  To get at strings you want to
use a
Char *.


-----Original Message-----
From: Jim Duffy [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 02, 2001 11:58 AM
To: Palm Developer Forum
Subject: Re: Packed Record HELP PLEASE


Thanx for this help Fox,

Could you add to the reading part a bit though?

For example,  What kind of pointer should I be using to get to the
strings.
I need to first get past my struct which is at the beginning of the
record
to get to my strings.

I tried:

MemPtr RecP;
MemHandle RecH

RecP = MemHandleLock(RecH);
// attempt to get pointer to beginning of strings.
RecP += (sizeof(MyRecType) + 1);

I also tried casting the pointer to a char* like:
RecP =  (char*) MemHandleLock(RecH);

But this gives me an "illegal type" error.

Any suggestions?

Thanx a bunch..

Jim


"Ingo Claro Fox" <[EMAIL PROTECTED]> wrote in message
news:44394@palm-dev-forum...
>
> you must use DmStrCopy to write the text to the databse to pack the
contents.
> Then when you read the record and have a pointer to it you do:
> recP+=StrLen(recP)+1
> to catch the next string.
>
>
>    DmWrite(RecPtr,StructSize,prefs.String1,String1Len);
> >   DmWrite(RecPtr,(StructSize +
String1Len),prefs.String2,String2Len);
> >   DmWrite(RecPtr,(StructSize + String1Len +
> >String2Len),prefs.String3,String3Len);
> >   MemHandleUnlock(NewRecordH);
> >   DmReleaseRecord(DBRef,Location,true);
>
> Ingo Claro Fox
> [EMAIL PROTECTED]
>
>
>



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





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