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/

Reply via email to