added macro RESULT_ERROR_FMT and some filesystem functions
This commit is contained in:
@@ -41,6 +41,7 @@ typedef struct Result_ {
|
||||
|
||||
|
||||
#define RESULT_ERROR(MSG, IS_MSG_ON_HEAP) (Result_){ .error = Error_create(MSG, IS_MSG_ON_HEAP, ErrorCallPos_here()) }
|
||||
#define RESULT_ERROR_FMT(FORMAT, ARGS...) RESULT_ERROR(sprintf_malloc(4096, FORMAT, ARGS), true)
|
||||
#define RESULT_VOID (Result_){ .error = NULL }
|
||||
#define RESULT_VALUE(FIELD, V) (Result_){ .error = NULL, .FIELD = V }
|
||||
|
||||
|
||||
@@ -47,6 +47,15 @@ Result(FILE*) file_open(cstr file_name, cstr fopen_mode);
|
||||
|
||||
bool file_exists(cstr path);
|
||||
|
||||
Result(i64) file_getSize(FILE* f);
|
||||
|
||||
typedef enum SeekOrigin {
|
||||
SeekOrigin_Start = SEEK_SET,
|
||||
SeekOrigin_Current = SEEK_CUR,
|
||||
SeekOrigin_End = SEEK_END,
|
||||
} SeekOrigin;
|
||||
|
||||
Result(void) file_seek(FILE* f, i64 offset, SeekOrigin origin);
|
||||
|
||||
|
||||
bool dir_exists(cstr path);
|
||||
|
||||
Reference in New Issue
Block a user