Tim,

1 - CharPtr c is a _pointer_ to a string.  It is not pointing to any valid
memory to store data.  You must allocate some memory and assign c to point
to that area.

2,3: These functions expect a Record Index not the Unique ID.

> ----------
> From:         Timothy Astle[SMTP:[EMAIL PROTECTED]]
> Reply To:     Palm Developer Forum
> Sent:         Thursday, April 13, 2000 2:24 PM
> To:   Palm Developer Forum
> Subject:      Bewildered...
> 
> CharPtr GetTripTripNumber(UInt UniqueID)
> {
>      CharPtr c;
>      tblTrip theTrip;
> 
>      VoidHand record = DmGetRecord(gTripDB, UniqueID);
>      tblPackedTripPtr p = MemHandleLock(record);
>      UnpackTrip(&theTrip, p);
>      StrCopy(c, theTrip.TripNumber);
>      MemHandleUnlock(record);
> 
>      return(c);
> }
> 
> 
> This function has been causing me much grief :-)  Here's what I've
> encountered thus far:
> 
> #1 It warns me that I should initialize CharPtr c before using it. (why??)
> #2 When I use DmGetRecord, I get an "Index out of Range" error, requiring
> a
> hard boot
> #3 If I change DmGetRecord to DmQueryRecord, and comment out all the other
> code, I get a different error.  (NULL based error, probably due to the
> fact
> I hard coded a NULL for a return value :-)
> 
> Now, I've heard something about clearing the busy bit... perhaps this has
> something to do with my problem?  I am aware that DmQueryRecord doesn't
> set
> the busy bit...
> 
> Tim
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palm.com/devzone/mailinglists.html
> 

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to