I think you meant to use DmSet, not DmWrite to clear the record.
DmWrite will write a block of data *starting* at the address of 'zero'.
It will not write the one address over and over.
Best Regards,
-jjf
-----Original Message-----
From: Dalmer Azevedo [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 01, 2000 5:37 PM
To: Palm Developer Forum
Subject: Problems with Database
Hi Gurus,
I am having problems with the followind code.
bool PalmDbImp::DBMCreateNewRecord()
{
VoidHand hHandler;
Err err = false;
Char zero = 0;
UInt uIndex = 0;
hHandler = DmNewRecord( s_db, &uIndex, sizeof(OfflineRecord) );
if( hHandler ) {
Ptr p;
// Get a point to the main block associated with the record
p = (Ptr) MemHandleLock( hHandler );
// Clear the record
err = DmWrite( p, 0, &zero, sizeof(OfflineRecord) );
MemPtrUnlock( p );
// Release the record
DmReleaseRecord( s_db, uIndex, true );
// Index of the current record
s_recordNum = 0;
err = true;
} else {
ErrFatalDisplayIf( err, "Could not create new record" );
err = false;
}
return err;
}
I have a C version of this code working in other application I
developed.
Today I decided to put it as a C++ class. The class represents a
generic
database.
Everything works fine. I am able to open the database, close, but when I
try
to create a new record and clean it I got the following message:
untitled 1.0 Has just read from memory manager data structures. This
happens
in the DmWrite call. The strange thing is I am locking the memory
before
writing on it.
Why is it complaining? Does it have to do with C++? Any thoughts?
Thank You
ATTACHMATE CORPORATION
Dalmer Azevedo
Mobile Technologies Practice
Voice 650 962 7173
Cell 408 569 6819
--
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