I'm working on my first app, and I've run into a snag.
I'm attempting to initialize a new record created for the db.
The code I'm using is this:
static Boolean CreateRecord()
{
UInt index = 0;
Char zero = 0;
UInt attr; // P11.
record attributes (category)
SweatInfoRecordPtr newRecord;
VoidHand recordH;
recordH = DmNewRecord (SweatDB, &CurrentRecord, sizeof
(SweatInfoRecord));
// Create a new first record in the database
if (recordH == NULL)
return dmErrMemError;
index = CurrentRecord;
// Lock down the block containing the new record.
newRecord = MemHandleLock(recordH);
InitializeNewRecord ((SweatInfoRecord *) newRecord);
and then InitializeNewRecord looks like this:
static void InitializeNewRecord (SweatInfoRecordPtr newRecord)
{
short i;
newRecord->currentCategory = CurrentCategory;
newRecord->topVisibleRecord = TopVisibleRecord;
newRecord->currentRecord = CurrentRecord;
for (i = 0; i< 45; i++)
{
newRecord->weight[i] = prefs.weight[i];
newRecord->reps[i] = prefs.reps[i];
newRecord->done[i] = false;
StrCopy (newRecord->name[i], prefs.name[i]);
}
TimSecondsToDateTime (TimGetSeconds (), &newRecord->theDate);
}
The problem is that while the simulator does this fine, (and the trace
looks ok, too), when I load this onto the emulator and call this code, it
says that the app has caused a bus error.
I don't have debug roms or the source yet (still waiting for palm to bless
me), so I'm kinda stuck.
Any initilization at all of this record seems to cause this error.
Any ideas?
____________________________________________________
John Spicer
H: (780) 903-6224
____________________________________________________
<mailto:[EMAIL PROTECTED]>
____________________________________________________
Author: MakeItGrow, MacLotto, TiCalendar, MacBillman,
Image-In Engine, TiCalendar, DrugMaster, MacDirectPay
If you want to work on your computer, buy an IBM.
If you want to DO work on your computer, buy a Mac.
____________________________________________________