---
name: "SDL_CloseIO"
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_CloseIO"
---

# SDL\_CloseIO(3)

Close and free an allocated SDL\_IOStream structure.

## NAME

SDL\_CloseIO - Close and free an allocated  **SDL\_IOStream**\
  structure.

## HEADER FILE

Defined in SDL3/SDL\_iostream.h

## SYNOPSIS

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

**bool SDL\_CloseIO(SDL\_IOStream \*context);**

## DESCRIPTION

**SDL\_CloseIO** () closes and cleans up the

**SDL\_IOStream**\
  stream. It releases any resources used by the stream and frees the  **SDL\_IOStream**\
  itself. This returns true on success, or false if the stream failed to flush to its output (e.g. to disk).

Note that if this fails to flush the stream for any reason, this function reports an error, but the  **SDL\_IOStream**\
  is still invalid once this function returns.

This call flushes any buffered writes to the operating system, but there are no guarantees that those writes have gone to physical media; they might be in the OS's file cache, waiting to go to disk later. If it's absolutely crucial that writes go to disk immediately, so they are definitely stored even if the power fails before the file cache would have caught up, one should call  **SDL\_FlushIO** () before closing. Note that flushing takes time and makes the system and your app operate less efficiently, so do so sparingly.

## FUNCTION PARAMETERS

- *context*

  **SDL\_IOStream**\
    structure to close.

## RETURN VALUE

Returns true on success or false on failure; call

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

## THREAD SAFETY

This function is not thread safe.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_OpenIO**(3)](/SDL_OpenIO/3.md)
