sdlIOprintf function iostream

int sdlIOprintf(
  1. Pointer<SdlIoStream> context,
  2. String? fmt
)

Print to an SDL_IOStream data stream.

This function does formatted printing to the stream.

\param context a pointer to an SDL_IOStream structure. \param fmt a printf() style format string. \param ... additional parameters matching % tokens in the fmt string, if any. \returns the number of bytes written or 0 on failure; call SDL_GetError() for more information.

\threadsafety Do not use the same SDL_IOStream from two threads at once.

\since This function is available since SDL 3.2.0.

\sa SDL_IOvprintf \sa SDL_WriteIO

extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2)

Implementation

int sdlIOprintf(Pointer<SdlIoStream> context, String? fmt) {
  final sdlIOprintfLookupFunction = _libSdl
      .lookupFunction<
        Uint32 Function(Pointer<SdlIoStream> context, Pointer<Utf8> fmt),
        int Function(Pointer<SdlIoStream> context, Pointer<Utf8> fmt)
      >('SDL_IOprintf');
  final fmtPointer = fmt != null ? fmt.toNativeUtf8() : nullptr;
  final result = sdlIOprintfLookupFunction(context, fmtPointer);
  calloc.free(fmtPointer);
  return result;
}