3.5.2 SDLNet_ResizePacket
int SDLNet_ResizePacket(UDPpacket *packet, int size)
- packet
- A pointer to the UDPpacket to be resized.
- size
- The new desired size, in bytes, of the data buffer to be allocated in the UDPpacket.
Zero is invalid.
Resize a UDPpackets data buffer to size bytes.
The old data buffer will not be retained, so the new buffer is invalid after this call.
Returns: the new size of the data in the packet.
If the number returned is less than what you asked for, that's an error.
| | // Resize a UDPpacket to hold 2048 bytes of data
//UDPpacket *packet;
int newsize;
newsize=SDLNet_ResizePacket(packet, 2048);
if(newsize<2048) {
printf("SDLNet_ResizePacket: %s\n", SDLNet_GetError());
// perhaps do something else since you didn't get the buffer you wanted
}
else {
// do stuff with the resized packet
}
|
|
See Also:
3.5.1 SDLNet_AllocPacket,
3.5.4 SDLNet_AllocPacketV,
3.5.3 SDLNet_FreePacket,
4.4 UDPpacket
This document was generated
on November, 3 2009
using texi2html