Function SDL_ReadIO

pub unsafe extern "C" fn SDL_ReadIO(
    context: *mut SDL_IOStream,
    ptr: *mut c_void,
    size: usize,
) -> usize
Available on crate feature dep_sdl3 only.
Expand description

Read from a data source.

This function reads up size bytes from the data source to the area pointed at by ptr. This function may read less bytes than requested.

This function will return zero when the data stream is completely read, and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If zero is returned and the stream is not at EOF, SDL_GetIOStatus() will return a different error value and SDL_GetError() will offer a human-readable message.

§Parameters

  • context: a pointer to an SDL_IOStream structure.
  • ptr: a pointer to a buffer to read data into.
  • size: the number of bytes to read from the data source.

§Return value

Returns the number of bytes read, or 0 on end of file or other failure; call SDL_GetError() for more information.

§Thread safety

This function is not thread safe.

§Availability

This function is available since SDL 3.2.0.

§See also