Hi all,
i'm trying to write two records to a database for a palm app and i'm new to
all of this pointing to positions in memory and all of that crack. i have a
fn to addtodatabase:
Err AddToDatabase (PlannerDBPtr record) {
Err error = errNone;
UInt16 newIndex = dmMaxRecordIndex;
MemHandle recHandle;
MemPtr recPointer;
UInt16 index;
recPointer = MemPtrNew(sizeof(PlannerDB));
((PlannerDBPtr)recPointer)->day = record->day;
index = GetFromDatabase((PlannerDBPtr)recPointer);
MemPtrFree(recPointer);
if (index == -1) {
recHandle = DmNewRecord(gDB, &newIndex,
sizeof(Weekday)+StrLen(record->Modules)+StrLen(record->Type)+1
if (recHandle) {
recPointer = MemHandleLock(recHandle);
DmWrite(recPointer, 0, &(record->day), sizeof
(Weekday));
DmWrite(recPointer, sizeof(Weekday), record->
Modules, StrLen(record->Modules)+1);
DmWrite(recPointer, sizeof(Weekday)+257, record->
Type, StrLen(record->Type)+1);
error = DmReleaseRecord(gDB, newIndex, true);
MemHandleUnlock(recHandle);
}
......
the offending field is Type which is declared as Char[100] in my struct,
(Moudules is 257). when i go to save it i get the error...
SysFatalAlert with the message: "DataMgr.c, Line:.....,DmWriteCheck failed".
would anyone be able to help????
Thanks a million
mark
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/