File handling module

File I/O operations as well as path and folder structure manipulation methods. With threading enabled, it also offers async read/write methods.

Classes

union zpl_file_descriptor
struct zpl_file_operations
struct zpl_file
struct zpl_async_file
struct zpl_file_contents

Typedefs

using zpl_file_mode = u32
using zplFileModeFlag = enum zplFileModeFlag
using zplSeekWhenceType = enum zplSeekWhenceType
using zplFileError = enum zplFileError
using zpl_file_descriptor = union zpl_file_descriptor
using zpl_file_operations = struct zpl_file_operations
using zpl_file_open_proc = zplFileError(zpl_file_descriptor*fd, zpl_file_operations*ops, zpl_file_mode mode, char const*filename)
using zpl_file_read_proc = b32(zpl_file_descriptor fd, void*buffer, isize size, i64 offset, isize*bytes_read, b32 stop_at_newline)
using zpl_file_write_proc = b32(zpl_file_descriptor fd, void const*buffer, isize size, i64 offset, isize*bytes_written)
using zpl_file_seek_proc = b32(zpl_file_descriptor fd, i64 offset, zplSeekWhenceType whence, i64*new_offset)
using zpl_file_close_proc = void(zpl_file_descriptor fd)
using zpl_file_time = u64
using zpl_file = struct zpl_file
using zpl_async_file = struct zpl_async_file
using zpl_async_file_cb = void(*)(zpl_async_file*file)
using zplFileStandardType = enum zplFileStandardType
using zpl_file_contents = struct zpl_file_contents

Functions

auto zpl_file_get_standard(zplFileStandardType std) -> zpl_file*
auto zpl_file_create(zpl_file* file, char const* filename) -> zplFileError
auto zpl_file_open(zpl_file* file, char const* filename) -> zplFileError
auto zpl_file_open_mode(zpl_file* file, zpl_file_mode mode, char const* filename) -> zplFileError
auto zpl_file_new(zpl_file* file, zpl_file_descriptor fd, zpl_file_operations ops, char const* filename) -> zplFileError
auto zpl_file_read_at_check(zpl_file* file, void* buffer, isize size, i64 offset, isize* bytes_read) -> b32
auto zpl_file_write_at_check(zpl_file* file, void const* buffer, isize size, i64 offset, isize* bytes_written) -> b32
auto zpl_file_read_at(zpl_file* file, void* buffer, isize size, i64 offset) -> b32
auto zpl_file_write_at(zpl_file* file, void const* buffer, isize size, i64 offset) -> b32
auto zpl_file_seek(zpl_file* file, i64 offset) -> i64
auto zpl_file_seek_to_end(zpl_file* file) -> i64
auto zpl_file_skip(zpl_file* file, i64 bytes) -> i64
auto zpl_file_tell(zpl_file* file) -> i64
auto zpl_file_close(zpl_file* file) -> zplFileError
auto zpl_file_read(zpl_file* file, void* buffer, isize size) -> b32
auto zpl_file_write(zpl_file* file, void const* buffer, isize size) -> b32
auto zpl_file_size(zpl_file* file) -> i64
auto zpl_file_name(zpl_file* file) -> char const *
auto zpl_file_truncate(zpl_file* file, i64 size) -> zplFileError
auto zpl_file_has_changed(zpl_file* file) -> b32
auto zpl_async_file_read(zpl_file* file, zpl_async_file_cb proc) -> void
auto zpl_async_file_write(zpl_file* file, void const* buffer, isize size, zpl_async_file_cb proc) -> void
auto zpl_file_temp(zpl_file* file) -> zplFileError
auto zpl_file_read_contents(zpl_allocator a, b32 zero_terminate, char const* filepath) -> zpl_file_contents
auto zpl_file_free_contents(zpl_file_contents* fc) -> void
auto zpl_file_read_lines(zpl_allocator alloc, zpl_array(char*)* lines, char const* filename, b32 strip_whitespace) -> char*
auto zpl_file_exists(char const* filepath) -> b32
auto zpl_file_last_write_time(char const* filepath) -> zpl_file_time
auto zpl_file_copy(char const* existing_filename, char const* new_filename, b32 fail_if_exists) -> b32
auto zpl_file_move(char const* existing_filename, char const* new_filename) -> b32
auto zpl_file_remove(char const* filename) -> b32
auto zpl_path_is_absolute(char const* path) -> b32
auto zpl_path_is_relative(char const* path) -> b32
auto zpl_path_is_root(char const* path) -> b32
auto zpl_path_base_name(char const* path) -> char const *
auto zpl_path_extension(char const* path) -> char const *
auto zpl_path_get_full_name(zpl_allocator a, char const* path) -> char*
auto zpl_path_mkdir(char const* path, i32 mode) -> zplFileError
auto zpl_path_rmdir(char const* path) -> zplFileError
auto zpl_path_dirlist(zpl_allocator alloc, char const* dirname, b32 recurse) -> zpl_string

Variables

zpl_file_operations const zpl_default_file_operations

Defines

#define ZPL_FILE_OPEN_PROC(name)
#define ZPL_FILE_READ_AT_PROC(name)
#define ZPL_FILE_WRITE_AT_PROC(name)
#define ZPL_FILE_SEEK_PROC(name)
#define ZPL_FILE_CLOSE_PROC(name)
#define ZPL_PATH_SEPARATOR