---
name: "SDL_IOStreamInterface"
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_IOStreamInterface"
---

# SDL\_IOStreamInterface(3type)

The function pointers that drive an SDL\_IOStream .

## NAME

SDL\_IOStreamInterface - The function pointers that drive an  **SDL\_IOStream** .

## HEADER FILE

Defined in SDL3/SDL\_iostream.h

## SYNOPSIS

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

**typedef struct SDL\_IOStreamInterface** **{**     **/\* The version of this interface \*/**     **Uint32 version;**     **/\*\***      **\*  Return the number of bytes in this SDL\_IOStream**      **\***      **\*  eturn the total size of the data stream, or -1 on error.**      **\*/**     **Sint64 (SDLCALL \*size)(void \*userdata);**     **/\*\***      **\*  Seek to \`offset\` relative to \`whence\`, one of stdio's whence values:**      **\*  SDL\_IO\_SEEK\_SET, SDL\_IO\_SEEK\_CUR, SDL\_IO\_SEEK\_END**      **\***      **\*  eturn the final offset in the data stream, or -1 on error.**      **\*/**     **Sint64 (SDLCALL \*seek)(void \*userdata, Sint64 offset, SDL\_IOWhence whence);**     **/\*\***      **\*  Read up to \`size\` bytes from the data stream to the area pointed**      **\*  at by \`ptr\`.**      **\***      **\*  On an incomplete read, you should set \`\*status\` to a value from the**      **\*  SDL\_IOStatus enum. You do not have to explicitly set this on**      **\*  a complete, successful read.**      **\***      **\*  eturn the number of bytes read**      **\*/**     **size\_t (SDLCALL \*read)(void \*userdata, void \*ptr, size\_t size, SDL\_IOStatus \*status);**     **/\*\***      **\*  Write exactly \`size\` bytes from the area pointed at by \`ptr\`**      **\*  to data stream.**      **\***      **\*  On an incomplete write, you should set \`\*status\` to a value from the**      **\*  SDL\_IOStatus enum. You do not have to explicitly set this on**      **\*  a complete, successful write.**      **\***      **\*  eturn the number of bytes written**      **\*/**     **size\_t (SDLCALL \*write)(void \*userdata, const void \*ptr, size\_t size, SDL\_IOStatus \*status);**     **/\*\***      **\*  If the stream is buffering, make sure the data is written out.**      **\***      **\*  On failure, you should set \`\*status\` to a value from the**      **\*  SDL\_IOStatus enum. You do not have to explicitly set this on**      **\*  a successful flush.**      **\***      **\*  eturn true if successful or false on write error when flushing data.**      **\*/**     **bool (SDLCALL \*flush)(void \*userdata, SDL\_IOStatus \*status);**     **/\*\***      **\*  Close and free any allocated resources.**      **\***      **\*  This does not guarantee file writes will sync to physical media; they**      **\*  can be in the system's file cache, waiting to go to disk.**      **\***      **\*  The SDL\_IOStream is still destroyed even if this fails, so clean up anything**      **\*  even if flushing buffers, etc, returns an error.**      **\***      **\*  eturn true if successful or false on write error when flushing data.**      **\*/**     **bool (SDLCALL \*close)(void \*userdata);** **} SDL\_IOStreamInterface;**

## DESCRIPTION

Applications can provide this struct to  **SDL\_OpenIO** () to create their own implementation of  **SDL\_IOStream** . This is not necessarily required, as SDL already offers several common types of I/O streams, via functions like  **SDL\_IOFromFile** () and

**SDL\_IOFromMem** ().

This structure should be initialized using

**SDL\_INIT\_INTERFACE** ()

## AVAILABILITY

This struct is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_INIT\_INTERFACE**(3)](/SDL_INIT_INTERFACE/3.md)
