diff options
author | Freya Murphy <freya@freyacat.org> | 2023-12-14 18:08:16 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2023-12-14 18:08:16 -0500 |
commit | 00c88659104ce423959151ff6f3f96f6537a6d68 (patch) | |
tree | c2745a95c2b7f15f69f8bfcaa85e0b12626f6142 /src/stream.h | |
download | nbtvis-00c88659104ce423959151ff6f3f96f6537a6d68.tar.gz nbtvis-00c88659104ce423959151ff6f3f96f6537a6d68.tar.bz2 nbtvis-00c88659104ce423959151ff6f3f96f6537a6d68.zip |
testing
Diffstat (limited to 'src/stream.h')
-rw-r--r-- | src/stream.h | 22 |
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); |