Tao.Sdl SDK Documentation

SdlNet.SDLNet_Read16 Method 

Get a 16bit (a short on 32bit systems) value from the data buffer area which is in network byte order.

[Visual Basic]
Public Shared Function SDLNet_Read16( _
   ByVal area As IntPtr _
) As Short
[C#]
public static short SDLNet_Read16(
   IntPtr area
);

Parameters

area
The pointer into a data buffer, at which to get the number from.

Remarks

This helps avoid byte order differences between two systems that are talking over the network. The returned 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.

Binds to C-function call in SDL_error.h:

extern DECLSPEC Uint16 SDLCALL SDLNet_Read16(void *area)

Example

            // get a number from a data buffer to use on this host
            //char *ptr; //this points into a previously received data buffer
            Sint16 number;
            number=(Sint16) SDLNet_Read16(ptr);
            // number is now in your hosts byte order, ready to use.
            

See Also

SdlNet Class | Tao.Sdl Namespace | SDLNet_Write16 | SDLNet_Read32