Read from a data source.
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. |
Returns the number of bytes read, or 0 on end of file or other error.
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. It will return zero when the data stream is completely read, or -1 on error. For streams that support non-blocking operation, if nothing was read because it would require blocking, this function returns -2 to distinguish that this is not an error or end-of-file, and the caller can try again later.
This function is available since SDL 3.0.0.