> gCurrentStatHand = MemHandleNew(sizeof (StaticRecordingInfo));
I've gotten bus errors when I try to write past the end of a string
try
gCurrentStatHand = MemHandleNew(sizeof (StaticRecordingInfo)+1);
You may need to add one byte for the end of string char (NULL)
Dave
-----Original Message-----
From: Philip J. Matheson <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, May 05, 1999 6:52 PM
Subject: Wicked Confused about memory
>Hi all,
>
>thanks for you plethora of suggestions on my last problem..
>
>I keep getting a bus err with this little chunk of code. . I'm following
>examples in the O'r book.. and Cripes! I can't figure out why. I'm sure
>it has something to do with my complete lack of understanding.. but I
>thought one second from yall would save me hours. :) Thanks..
>
>static Boolean DatabaseOkButtonHook(void)
>{
> StaticRecordingInfo *LCurrentStatPtr;
> FieldPtr fld = GetObjectPtr(databaseNameStringField);
>
> gCurrentStatHand = MemHandleNew(sizeof (StaticRecordingInfo));
> LCurrentStatPtr = MemHandleLock(gCurrentStatHand);
>
> //here we're copying the new database name into memory
> if (FldGetTextPtr(fld) != NULL)
> {
> StrCopy(LCurrentStatPtr->NameString, FldGetTextPtr(fld));
> }
> MemHandleUnlock(gCurrentStatHand);
>
> if ( checkDBName(LCurrentStatPtr->NameString) )
> {
> FrmGotoForm(RecordForm);
> }
> else
> {
> FrmAlert(DbnameAlert);
> }
> return 0;
> }
>
>Any ideas?
>
>Thanks again,
>
>Philip J.
>
>
>
>