Scroll to navigation

SDL_WriteIO(3) SDL3 FUNCTIONS SDL_WriteIO(3)

NAME

SDL_WriteIO - Write to an SDL_IOStream
data stream.

SYNOPSIS

#include "SDL3/SDL.h"
size_t SDL_WriteIO(SDL_IOStream *context, const void *ptr, size_t size);

DESCRIPTION

This function writes exactly size bytes from the area pointed at by ptr to the stream. If this fails for any reason, it'll return less than size to demonstrate how far the write progressed. On success, it returns num .

On error, this function still attempts to write as much as possible, so it might return a positive value less than the requested write size. If the function failed to write anything and there was an actual error, it will return -1. For streams that support non-blocking operation, if nothing was written because it would require blocking, this function returns -2 to distinguish that this is not an error and the caller can try again later.

It is an error to specify a negative size , but this parameter is signed so you definitely cannot overflow the return value on a successful run with enormous amounts of data.

FUNCTION PARAMETERS

a pointer to an SDL_IOStream
structure
a pointer to a buffer containing data to write
the number of bytes to write

RETURN VALUE

Returns the number of bytes written, which will be less than num on error; call SDL_GetError () for more information.

AVAILABILITY

This function is available since SDL 3.0.0.

SEE ALSO

SDL_IOprintf(3), SDL_ReadIO(3), SDL_SeekIO(3)

SDL 3.1.0 SDL