[SDL] [SPAM] Preparing a UDP packet with SDL_net
Gabriele Greco
gabriele.greco at darts.it
Fri Jun 22 03:52:11 PDT 2007
James Buchwald wrote:
>
> SDLNet_Write16(src, packet->data[position]);
I think this should be:
SDLNet_Write16(src, (char *)packet->data + position);
The cast may not be needed if packet->data is already a pointer to an
8bit sized type.
> Whenever my code runs, however, I get a segfault the first time
> SDLNet_Write16 is called. The packet was successfully created, though,
> and position is set to 0. Now I can't figure out what I'm doing wrong.
You were writing to the memory address 0 (data[x] was zeroed for every x
:) )
Bye,
Gabry
More information about the SDL
mailing list