How about giving CharPtr c a little memory. I don't think you can blindly
copy into a pointer.

c = MemPtrNew(StrLen(theTrip.TripNumber + 1));
if(c == NULL)
    // error , no memory left

-----Original Message-----
From: Timothy Astle <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: Palm Developer Forum <[EMAIL PROTECTED]>
Date: Thursday, April 13, 2000 2:23 PM
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