You have to worry about basically the same thing - make sure that the record you are writing to is big enough to hold the data you're writing to it. Your code looks ok in that respect - so I'm not sure what could be going on there...
-----Original Message----- From: l e s s [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 26, 2001 11:55 AM To: Palm Developer Forum Subject: RE: DmWrite or DmWriteCheck? Off of the screen text? oh! sorry! ignore my last post!!! that wasnt the function that was giving me problems... i dont use DmStrCopy in the function that is causing problems...just DmWrite (see below) is there anything "typical" i have to worry about when doing it this way? thanks for any insight you can provide.. --------------------- void insertRecResultsDb(VoidHand ResultsHand,Results* ResultsStruct) { UInt length = 0; CharPtr s; UInt offset = 0; length = sizeof(ResultsStruct->ResultID) + sizeof(ResultsStruct->CurrentRec); if(MemHandleResize(ResultsHand,length) == 0) { s = MemHandleLock(ResultsHand); offset = 0; DmWrite(s, offset,&ResultsStruct->ResultID,sizeof(ResultsStruct->ResultID)); offset += sizeof(ResultsStruct->ResultiD); DmWrite(s, offset,&ResultsStruct->CurrentRec,sizeof(ResultsStruct->CurrentRec)); MemHandleUnlock(ResultsHand); } } ------------------------------------- On Wed, 26 Dec 2001, l e s s wrote: > > i dont use DmNewHandle but I do use DmStrCopy in the function that is > inserting the records into the db... > > is there anything wrong with that? > > ------ > void insertRecFormDb(VoidHand FormHand,FormContainer* FormStruct, PODSMgr* > mgr) > > { > CharPtr s; > UInt offset =0; > if(MemHandleResize(FormHand,20) == 0) > { > s = MemHandleLock(FormHand); > offset = 0; > DmStrCopy(s, offset, FormStruct->FieldValue); > MemHandleUnlock(FormHand); > } > } > > > > On Wed, 26 Dec 2001, Kevin OKeefe wrote: > > > DmWriteCheck is failing, so you won't actually every do the actual write. This >function usually fails because you're trying to copy something larger than will fit >in the chunk you are writing too. I'd wager that a great majority of the times this >fails it is because one allocated a new chunk for a string by doing >DmNewHandle(dbRef, StrLen(theString)), and then called DmStrCopy. Since DmStrCopy >also copies the null terminator, DmWriteCheck will fail because one is attempting to >write one more character than one allocated. There are, of course, other ways for >this to fail, but this demonstrates the typical problem.... > > > > Kevin > > > > DmWriteCheck will also fail if the chunk is not locked. > > -----Original Message----- > > From: l e s s [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, December 25, 2001 11:34 PM > > To: Palm Developer Forum > > Subject: DmWrite or DmWriteCheck? Off of the screen text? > > > > > > hi.. > > > > ive been posting a question about a DmWriteCheck failed error ive been > > getting that has started going towards what i can do to step thru the code > > and see exactly whats happening.. > > > > BUT! i wanted to take a step back to the original question about the error > > itself..its saying DmWriteCheck is failing..not the actual writing to the > > record...is this significant (is the record size not the only thing that > > could be causing the problem)? i guess not really..it would be because > > DmWriteCheckmakes sure DmWrite would be able to go through so if the > > record was sized wrong, it would fail there? > > > > does anyone know anything about maybe when looking at an extra long field > > in the form..or just extra long text, the palm doesnt recognize the text > > offscreen when we want it to save the whole thing or something like > > that..? im just trying to think of anything that could be wrong...i dont > > know much to start with but ive been pounding my head over this for days > > and am so lost.. > > > > thanks in advance for any help.. > > > > leslie > > > > > > > > -- > > 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/ > > > > > ~LeSLie > **************************************** > So many adventures couldn't happen today > So many songs we forgot to play... > **************************************** > > > -- > 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/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
