Scroll to navigation

SDL_ShowSaveFileDialog(3) SDL3 FUNCTIONS SDL_ShowSaveFileDialog(3)

NAME

SDL_ShowSaveFileDialog - Displays a dialog that lets the user choose a new or existing file on their filesystem.

SYNOPSIS

#include "SDL3/SDL.h"
void SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, const char *default_location);

DESCRIPTION

This function should only be invoked from the main thread.

This is an asynchronous function; it will return immediately, and the result will be passed to the callback.

The callback will be invoked with a null-terminated list of files the user chose. The list will be empty if the user canceled the dialog, and it will be NULL if an error occured.

Note that the callback may be called from a different thread than the one the function was invoked on.

The chosen file may or may not already exist.

FUNCTION PARAMETERS

The function to be invoked when the user selects a file and accepts, or the user cancels the dialog, or an error occurs. The first argument is a null-terminated list of C strings, representing the paths chosen by the user. The list will be empty if the user canceled the dialog, and it will be NULL if an error occured. If an error occured, it can be fetched with SDL_GetError (). The second argument is the userdata pointer passed to the function.
An optional pointer to pass extra data to the callback when it will be invoked.
The window that the dialog should be modal for. May be NULL. Not all platforms support this option.
A null-terminated list of SDL_DialogFileFilter
The default folder or file to start the dialog at. May be NULL. Not all platforms support this option.

AVAILABILITY

This function is available since SDL 3.0.0.

SEE ALSO

SDL_ShowOpenFileDialog(3)

SDL 3.1.0 SDL