sdlAtof function

double sdlAtof(
  1. String? str
)

Parse a double from a string.

The result of calling SDL_atof(str) is equivalent to SDL_strtod(str, NULL).

\param str The null-terminated string to read. Must not be NULL. \returns The parsed double.

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

\since This function is available since SDL 3.1.3.

\sa SDL_atoi \sa SDL_strtol \sa SDL_strtoul \sa SDL_strtoll \sa SDL_strtoull \sa SDL_strtod

extern SDL_DECLSPEC double SDLCALL SDL_atof(const char *str)

Implementation

double sdlAtof(String? str) {
  final sdlAtofLookupFunction = libSdl3.lookupFunction<
      Double Function(Pointer<Utf8> str),
      double Function(Pointer<Utf8> str)>('SDL_atof');
  final strPointer = str != null ? str.toNativeUtf8() : nullptr;
  final result = sdlAtofLookupFunction(strPointer);
  calloc.free(strPointer);
  return result;
}