---
name: "SDL_DialogFileCallback"
section: "3type"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_DialogFileCallback"
---

# SDL\_DialogFileCallback(3type)

Callback used by file dialog functions.

## NAME

SDL\_DialogFileCallback - Callback used by file dialog functions.

## HEADER FILE

Defined in SDL3/SDL\_dialog.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**typedef void (SDLCALL \*SDL\_DialogFileCallback)(void \*userdata, const char \* const \*filelist, int filter);**

## DESCRIPTION

The specific usage is described in each function.

If **filelist** is:

• NULL, an error occurred. Details can be obtained with

**SDL\_GetError** ().

• A pointer to NULL, the user either didn't choose any file or canceled the\
   dialog.

• A pointer to non- **NULL** , the user chose one or more files. The argument\
   is a null-terminated array of pointers to UTF-8 encoded strings, each\
   containing a path.

The filelist argument should not be freed; it will automatically be freed when the callback returns.

The filter argument is the index of the filter that was selected, or -1 if no filter was selected or if the platform or method doesn't support fetching the selected filter.

In Android, the **filelist** are **content://** URIs. They should be opened using  **SDL\_IOFromFile** () with appropriate modes. This applies both to open and save file dialog.

## FUNCTION PARAMETERS

- *userdata*

  an app-provided pointer, for the callback's use.

- *filelist*

  the file(s) chosen by the user.

- *filter*

  index of the selected filter.

## AVAILABILITY

This datatype is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_DialogFileFilter**(3type)](/SDL_DialogFileFilter/3type.md), **•**(3), [**SDL\_ShowOpenFileDialog**(3)](/SDL_ShowOpenFileDialog/3.md), **•**(3), [**SDL\_ShowSaveFileDialog**(3)](/SDL_ShowSaveFileDialog/3.md), **•**(3), [**SDL\_ShowOpenFolderDialog**(3)](/SDL_ShowOpenFolderDialog/3.md), **•**(3), [**SDL\_ShowFileDialogWithProperties**(3)](/SDL_ShowFileDialogWithProperties/3.md)
