sdlWriteStorageFile function storage
bool
sdlWriteStorageFile(
- Pointer<
SdlStorage> storage, - String? path,
- Pointer<
NativeType> source, - int length,
Synchronously write a file from client memory into a storage container.
\param storage a storage container to write to. \param path the relative path of the file to write. \param source a client-provided buffer to write from. \param length the length of the source buffer. \returns true if the file was written or false on failure; call SDL_GetError() for more information.
\since This function is available since SDL 3.2.0.
\sa SDL_GetStorageSpaceRemaining \sa SDL_ReadStorageFile \sa SDL_StorageReady
extern SDL_DECLSPEC bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length)
Implementation
bool sdlWriteStorageFile(
Pointer<SdlStorage> storage,
String? path,
Pointer<NativeType> source,
int length,
) {
final sdlWriteStorageFileLookupFunction = _libSdl
.lookupFunction<
Uint8 Function(
Pointer<SdlStorage> storage,
Pointer<Utf8> path,
Pointer<NativeType> source,
Uint64 length,
),
int Function(
Pointer<SdlStorage> storage,
Pointer<Utf8> path,
Pointer<NativeType> source,
int length,
)
>('SDL_WriteStorageFile');
final pathPointer = path != null ? path.toNativeUtf8() : nullptr;
final result =
sdlWriteStorageFileLookupFunction(storage, pathPointer, source, length) ==
1;
calloc.free(pathPointer);
return result;
}