sdlVsscanf function

int sdlVsscanf(
  1. String? text,
  2. String? fmt,
  3. Pointer<NativeType> arg2
)

This works exactly like vsscanf() but doesn't require access to a C runtime.

Functions identically to SDL_sscanf(), except it takes a va_list instead of using ... variable arguments.

\param text the string to scan. Must not be NULL. \param fmt a printf-style format string. Must not be NULL. \param ap a va_list of pointers to values to be filled in with scanned items. \returns the number of items that matched the format string.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2)

Implementation

int sdlVsscanf(String? text, String? fmt, Pointer<NativeType> arg2) {
  final sdlVsscanfLookupFunction = libSdl3.lookupFunction<
      Int32 Function(
          Pointer<Utf8> text, Pointer<Utf8> fmt, Pointer<NativeType> arg2),
      int Function(Pointer<Utf8> text, Pointer<Utf8> fmt,
          Pointer<NativeType> arg2)>('SDL_vsscanf');
  final textPointer = text != null ? text.toNativeUtf8() : nullptr;
  final fmtPointer = fmt != null ? fmt.toNativeUtf8() : nullptr;
  final result = sdlVsscanfLookupFunction(textPointer, fmtPointer, arg2);
  calloc.free(textPointer);
  calloc.free(fmtPointer);
  return result;
}