---
name: "SDL_WriteIO"
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_WriteIO"
---

# SDL\_WriteIO(3)

Write to an SDL\_IOStream data stream.

## NAME

SDL\_WriteIO - Write to an  **SDL\_IOStream**\
  data stream.

## HEADER FILE

Defined in SDL3/SDL\_iostream.h

## SYNOPSIS

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

**size\_t SDL\_WriteIO(SDL\_IOStream \*context, const void \*ptr, size\_t size);**

## DESCRIPTION

This function writes exactly **size** bytes from the area pointed at by **ptr** to the stream. If this fails for any reason, it'll return less than **size** to demonstrate how far the write progressed. On success, it returns **size** .

On error, this function still attempts to write as much as possible, so it might return a positive value less than the requested write size.

The caller can use  **SDL\_GetIOStatus** () to determine if the problem is recoverable, such as a non-blocking write that can simply be retried later, or a fatal error.

## FUNCTION PARAMETERS

- *context*

  a pointer to an  **SDL\_IOStream**\
    structure.

- *ptr*

  a pointer to a buffer containing data to write.

- *size*

  the number of bytes to write.

## RETURN VALUE

Returns the number of bytes written, which will be less than **size** 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\_IOprintf**(3)](/SDL_IOprintf/3.md), **•**(3), [**SDL\_ReadIO**(3)](/SDL_ReadIO/3.md), **•**(3), [**SDL\_SeekIO**(3)](/SDL_SeekIO/3.md), **•**(3), [**SDL\_FlushIO**(3)](/SDL_FlushIO/3.md), **•**(3), [**SDL\_GetIOStatus**(3)](/SDL_GetIOStatus/3.md)
