On Mon, 22 Mar 1999, Fawcett, Mitch wrote:
> Put an ampersand (&) before the zero and your code should work. This
> demonstrates what the function is looking for in terms of arguments. It
> wants a pointer to the index number for the new record, not the index number
> itself. Using &0 will insert the new record at the beginning of the
> database.
>
> NewRecord = DmNewRecord(VitalSignsDB,&0,RecSize);
Um, no, I wouldn't recommend this. CW may do something useful (generate a
temporary int, assign zero to it, and return the address of that
temporary), but I doubt it. &0 is meaningless in standard C. If you want a
NULL pointer, please just use the NULL macro which is guaranteed to be
cast in an appropriate fashion. If you want to pass in a pointer argument,
you'll have to pass the address of a real variable:
UInt idx;
NewRecord = DmNewRecord(VitalSignsDB, &idx, RecSize);
> > -----Original Message-----
> > From: Murray Dowling [SMTP:[EMAIL PROTECTED]]
> > Sent: Monday, March 22, 1999 5:05 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: DmNewRecord writes to Low mem?
> >
> > > The following snippet always generates a write to low memory error
> > > on the DmNewRecord statement
> >
> > <snippet snipped>
> >
> > > // Get a new record of the proper size
> > > NewRecord = DmNewRecord(VitalSignsDB,0,RecSize);
> >
> >
> > The second parameter to DmNewRecord is a UIntPtr which should be
> > pointing to the index of the position you wish to insert the record
> > at. The actual index assigned is returned via this pointer. You are
> > passing a null pointer. I think we see where the write to low memory
> > is coming from.
> >
> > Hope this helps,
> > Murray Dowling
> > Deskfree Computing
> > http://www.deskfree.com/
>
>
--
Kenneth Albanowski ([EMAIL PROTECTED], CIS: 70705,126)