summaryrefslogtreecommitdiff
path: root/src/stream.h
blob: e9fd920d2a7c50eea7693f6dc66a42656768947d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);