summaryrefslogtreecommitdiff
path: root/plat.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-07-13 23:45:08 +1000
committerquou <quou@disroot.org>2024-07-13 23:45:08 +1000
commita43eb70ebe7844db0a4ffece47c22ae12384781b (patch)
tree57bde2c38a15602ecdad23627970aafbddf587a7 /plat.h
parent5f59b1517ef18d85e6dd05f2985e5a441deb5cac (diff)
Add file API
Diffstat (limited to 'plat.h')
-rw-r--r--plat.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/plat.h b/plat.h
index 7e4f445..419d7fe 100644
--- a/plat.h
+++ b/plat.h
@@ -29,6 +29,29 @@ void print_err(const char* fmt, ...);
void print_war(const char* fmt, ...);
void pbreak(Error code);
+typedef struct File File;
+
+typedef enum {
+ file_flags_write = 1 << 0,
+ file_flags_read = 1 << 1,
+ file_flags_read_write = 1 << 2,
+ file_flags_create = 1 << 3
+} File_Flags;
+
+typedef enum {
+ file_whence_begin,
+ file_whence_end,
+ file_whence_cur
+} File_Whence;
+
+File* file_open(const char* name, File_Flags flags);
+void file_close(File* file);
+void file_read(File* file, void* buffer, int size);
+void file_write(File* file, const void* buffer, int size);
+void file_seek(File* file, int offset, File_Whence whence);
+int file_size(File* file);
+int file_exists(const char* name);
+
typedef struct {
int mpf;
int fps;