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

# SDL\_LoadFileAsync(3)

Load all the data from a file path, asynchronously.

## NAME

SDL\_LoadFileAsync - Load all the data from a file path, asynchronously.

## HEADER FILE

Defined in SDL3/SDL\_asyncio.h

## SYNOPSIS

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

**bool SDL\_LoadFileAsync(const char \*file, SDL\_AsyncIOQueue \*queue, void \*userdata);**

## DESCRIPTION

This function returns as quickly as possible; it does not wait for the read to complete. On a successful return, this work will continue in the background. If the work begins, even failure is asynchronous: a failing return value from this function only means the work couldn't start at all.

The data is allocated with a zero byte at the end (null terminated) for convenience. This extra byte is not included in

**SDL\_AsyncIOOutcome**

This function will allocate the buffer to contain the file. It must be deallocated by calling  **SDL\_free** () on

**SDL\_AsyncIOOutcome**

An  **SDL\_AsyncIOQueue**\
  must be specified. The newly-created task will be added to it when it completes its work.

## FUNCTION PARAMETERS

- *file*

  the path to read all available data from.

- *queue*

  a queue to add the new  **SDL\_AsyncIO**\
    to.

- *userdata*

  an app-defined pointer that will be provided with the task results.

## RETURN VALUE

Returns true on success or false on failure; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_LoadFile\_IO**(3)](/SDL_LoadFile_IO/3.md)
