SDLNet_Write16

Name

SDLNet_Write16 -- Put a 16bit number in network ordered data.

Synopsis

void SDLNet_Write16(Uint16 value, void *area);

Description

Put the 16bit (a short on 32bit systems) value into the data buffer area in network byte order. This helps avoid byte order differences between two systems that are talking over the network. The value can be a signed number, the unsigned parameter type doesn't affect the data. The area pointer need not be at the beginning of a buffer, but must have at least 2 bytes of space left, including the byte currently pointed at.

Example

// put my number into a data buffer to prepare for sending to a remote host
char data[1024];
Sint16 number=12345;
SDLNet_Write16((Uint16)number,data);

See Also

SDLNet_Read16, SDLNet_Read32, SDLNet_Write32

SDLNet_Write16 (last edited 2008-04-17 08:18:56 by localhost)