sdlRWseek function

int sdlRWseek(
  1. Pointer<SdlRWops> context,
  2. int offset,
  3. int whence
)

Seek within an SDL_RWops data stream.

This function seeks to byte offset, relative to whence.

whence may be any of the following values:

  • RW_SEEK_SET: seek from the beginning of data
  • RW_SEEK_CUR: seek relative to current read point
  • RW_SEEK_END: seek relative to the end of data

If this stream can not seek, it will return -1.

SDL_RWseek() is actually a wrapper function that calls the SDL_RWops's seek 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 offset an offset in bytes, relative to whence location; can be negative \param whence any of RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END \returns the final offset in the data stream after the seek or -1 on error.

\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_RWread \sa SDL_RWtell \sa SDL_RWwrite

extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence)

Implementation

int sdlRWseek(Pointer<SdlRWops> context, int offset, int whence) {
  final sdlRWseekLookupFunction = libSdl2.lookupFunction<
      Int64 Function(Pointer<SdlRWops> context, Int64 offset, Int32 whence),
      int Function(
          Pointer<SdlRWops> context, int offset, int whence)>('SDL_RWseek');
  return sdlRWseekLookupFunction(context, offset, whence);
}