picofuse

io.h
Go to the documentation of this file.
1 
31 #pragma once
32 #include <stdbool.h>
33 #include <stddef.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
44 #ifndef SYS_IOSTREAM_CAPACITY
45 #define SYS_IOSTREAM_CAPACITY 8
46 #endif
47 
53 #define SYS_IOSTREAM_EOF (-1)
54 
56 // TYPES
57 
69 
71 // LIFECYCLE
72 
81 extern void sys_iostream_close(sys_iostream_t *s);
82 
84 // METHODS
85 
95 extern int sys_iostream_peek(sys_iostream_t *s);
96 
106 extern size_t sys_iostream_read(sys_iostream_t *s, char *buf, size_t n);
107 
119 extern size_t sys_iostream_write(sys_iostream_t *s, const char *buf, size_t n);
120 
133 extern ptrdiff_t sys_iostream_seek(sys_iostream_t *s, ptrdiff_t offset,
134  bool abs);
135 
137 
138 #ifdef __cplusplus
139 }
140 #endif
int sys_iostream_peek(sys_iostream_t *s)
Look at the next byte without consuming it.
size_t sys_iostream_read(sys_iostream_t *s, char *buf, size_t n)
Read bytes from a stream.
struct sys_iostream_t sys_iostream_t
An opaque byte stream.
Definition: io.h:68
ptrdiff_t sys_iostream_seek(sys_iostream_t *s, ptrdiff_t offset, bool abs)
Move a stream&#39;s read/write position.
size_t sys_iostream_write(sys_iostream_t *s, const char *buf, size_t n)
Write bytes to a stream.
void sys_iostream_close(sys_iostream_t *s)
Release a stream back to the pool.