summaryrefslogtreecommitdiff
path: root/src/stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream.h')
-rw-r--r--src/stream.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/stream.h b/src/stream.h
new file mode 100644
index 0000000..e9fd920
--- /dev/null
+++ b/src/stream.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdbool.h>
+
+typedef struct {
+ FILE *__file;
+ bool __alloc;
+} stream_t;
+
+stream_t stream_open(char *path, char* mode);
+void stream_close(stream_t *stream);
+bool stream_read(stream_t *stream, void *res, size_t amount);
+
+bool stream_read_i8(stream_t *stream, int8_t *res);
+bool stream_read_i16(stream_t *stream, int16_t *res);
+bool stream_read_i32(stream_t *stream, int32_t *res);
+bool stream_read_i64(stream_t *stream, int64_t *res);
+
+bool stream_read_u16(stream_t *stream, uint16_t *res);
+bool stream_read_u32(stream_t *stream, uint32_t *res);