libclod
C library for interacting with NBTs, region files, LOD data and other things.
Loading...
Searching...
No Matches
stream.h
1
5#ifndef LIBCLOD_IO_H
6#define LIBCLOD_IO_H
7
8#include <clod/lib.h>
9#include <clod/string.h>
10
12#define CLOD_STREAM_OK 0
14#define CLOD_STREAM_EOF (-1)
16#define CLOD_STREAM_INVALID (-2)
18#define CLOD_STREAM_INTERRUPTED (-3)
19
20typedef struct clod_stream clod_stream;
21
23CLOD_API
24extern clod_stream *clod_stdin;
25
27CLOD_API
28extern clod_stream *clod_stdout;
29
31CLOD_API
32extern clod_stream *clod_stderr;
33
59 uintptr_t impl;
60
72 int (*read)(clod_stream *self, struct clod_string *dst);
73
88 int (*write)(clod_stream *self, struct clod_string *src);
89
102 int (*close)(clod_stream *self);
103};
104
116CLOD_API CLOD_NONNULL(1, 2, 3)
117int clod_stream_copy(clod_stream *dst, clod_stream *src, void *buffer, size_t buffer_size, size_t *total_transferred);
118
128CLOD_API CLOD_NONNULL(1, 2)
129void clod_pipe(clod_stream *pipe1_out, clod_stream *pipe2_out);
130
139CLOD_API CLOD_NONNULL(1)
140int clod_stream_format(clod_stream *dst, struct clod_string fmt, ...);
141
143CLOD_API CLOD_NONNULL(1)
144int clod_stream_vformat(clod_stream *dst, struct clod_string fmt, va_list args);
145
146#endif
Sized string helpers.
int(* write)(clod_stream *self, struct clod_string *src)
Definition stream.h:88
uintptr_t impl
Definition stream.h:59
int(* read)(clod_stream *self, struct clod_string *dst)
Definition stream.h:72
int(* close)(clod_stream *self)
Definition stream.h:102