sdlRWwrite function

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

Write to an SDL_RWops data stream.

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

SDL_RWwrite is actually a function wrapper that calls the SDL_RWops's write 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 containing data to write \param size the size of an object to write, in bytes \param num the number of objects to write \returns the number of objects written, which will be less than num on error; 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_RWread \sa SDL_RWseek

extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num)

Implementation

int sdlRWwrite(
    Pointer<SdlRWops> context, Pointer<NativeType> ptr, int size, int num) {
  final sdlRWwriteLookupFunction = libSdl2.lookupFunction<
      Uint32 Function(Pointer<SdlRWops> context, Pointer<NativeType> ptr,
          Uint32 size, Uint32 num),
      int Function(Pointer<SdlRWops> context, Pointer<NativeType> ptr, int size,
          int num)>('SDL_RWwrite');
  return sdlRWwriteLookupFunction(context, ptr, size, num);
}