Richard, thanks a lot I will try that, but suppose that I would like to
write the entire structure, could I do the followig?
DmWrite( JugadorPtr, 0, Jugador, size);
or not? What should I do instead?
Thanks,
Nicolas
-----Mensaje original-----
De: Richard Burmeister <[EMAIL PROTECTED]>
Para: Palm Developer Forum <[EMAIL PROTECTED]>
Fecha: Mi�rcoles, 25 de Abril de 2001 02:46 a.m.
Asunto: RE: DmNewRecord
>From: "Nicolas Raitman"
>>
>> size = StrLen ( Jugador.NickName ) + StrLen ( Jugador.Nombre ) + 2;
>> recordHandle = DmNewRecord ( JugadoresDB, &index , size );
>> JugadorPtr = MemHandleLock ( recordHandle );
>> // here is where the pose tells me that a fatal exeption ocurred... what
>is
>> wrong?
>> DmWrite ( recordHandle, 0, Jugador.Nombre, size );
>> MemHandleUnlock ( recordHandle );
>> DmReleaseRecord ( JugadoresDB, index, true );
>> }
>
>When you use DmWrite, Jugador.Nombre is StrLen(Jugado.Nombre)+1 bytes long.
>However, you tell DmWrite to write out size bytes, which is
>StrLen(Jugador.NickName)+StrLen(Jugador.Nombre)+2 bytes. So it is trying
to
>write more bytes than you have in el Nombre. To do that, it has to read
>beyond the end of Jugador.Nombre, accessing some memory it shouldn't. If
>you want to write both values, use:
>
>DmWrite( JugadorPtr, 0, Jugador.Nombre, StrLen(Jugador.Nombre) + 1 );
>DmWrite( JugadorPtr, StrLen(Jugador.Nombre) + 1, Jugador.NickName,
>StrLen(Jugador.NickName) + 1 );
>
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/