sdlRWread function

int sdlRWread(
  1. Pointer<SdlRWops> context,
  2. Pointer<NativeType> ptr,
  3. int size,
  4. int maxnum,
)

Read from a data source.

This function reads up to maxnum objects each of size size from the data source to the area pointed at by ptr. This function may read less objects than requested. It will return zero when there has been an error or the data stream is completely read.

SDL_RWread() is actually a function wrapper that calls the SDL_RWops's read method appropriately, to simplify application development.

Prior to SDL 2.0.10, this function was a macro.

\param context a pointer to an SDL_RWops structure \param ptr a pointer to a buffer to read data into \param size the size of each object to read, in bytes \param maxnum the maximum number of objects to be read \returns the number of objects read, or 0 at error or end of file; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.10.

\sa SDL_RWclose \sa SDL_RWFromConstMem \sa SDL_RWFromFile \sa SDL_RWFromFP \sa SDL_RWFromMem \sa SDL_RWseek \sa SDL_RWwrite

extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context, void *ptr, size_t size, size_t maxnum)

Implementation

int sdlRWread(
    Pointer<SdlRWops> context, Pointer<NativeType> ptr, int size, int maxnum) {
  final sdlRWreadLookupFunction = libSdl2.lookupFunction<
      Uint32 Function(Pointer<SdlRWops> context, Pointer<NativeType> ptr,
          Uint32 size, Uint32 maxnum),
      int Function(Pointer<SdlRWops> context, Pointer<NativeType> ptr, int size,
          int maxnum)>('SDL_RWread');
  return sdlRWreadLookupFunction(context, ptr, size, maxnum);
}