picofuse

Macros | Typedefs | Functions
io.h File Reference

Opaque byte-stream type for reading and writing, backed by different sources (strings today; files and others can be added later without changing this interface). More...

#include <stdbool.h>
#include <stddef.h>
Include dependency graph for io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SYS_IOSTREAM_CAPACITY   8
 Maximum number of open streams.
 
#define SYS_IOSTREAM_EOF   (-1)
 Sentinel returned by sys_iostream_peek() at the end of a stream.
 

Typedefs

typedef struct sys_iostream_t sys_iostream_t
 An opaque byte stream. More...
 

Functions

void sys_iostream_close (sys_iostream_t *s)
 Release a stream back to the pool. More...
 
int sys_iostream_peek (sys_iostream_t *s)
 Look at the next byte without consuming it. More...
 
size_t sys_iostream_read (sys_iostream_t *s, char *buf, size_t n)
 Read bytes from a stream. More...
 
size_t sys_iostream_write (sys_iostream_t *s, const char *buf, size_t n)
 Write bytes to a stream. More...
 
ptrdiff_t sys_iostream_seek (sys_iostream_t *s, ptrdiff_t offset, bool abs)
 Move a stream's read/write position. More...
 

Detailed Description

Opaque byte-stream type for reading and writing, backed by different sources (strings today; files and others can be added later without changing this interface).

Definition in file io.h.