From a43eb70ebe7844db0a4ffece47c22ae12384781b Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 13 Jul 2024 23:45:08 +1000 Subject: Add file API --- plat.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'plat.h') 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; -- cgit v1.2.3-54-g00ecf