feat(file): added enum for error handling

This commit is contained in:
Mineplay 2025-12-05 17:16:59 +01:00
parent 5ea177d928
commit 59928a9a55
3 changed files with 14 additions and 5 deletions

4
.gitignore vendored
View file

@ -65,5 +65,7 @@ compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
_deps _deps
CMakeUserPresets.json CMakeUserPresets.json
build build
# clangd
.cache/

View file

@ -9,7 +9,12 @@
#ifndef COSMS_CORE_FILE #ifndef COSMS_CORE_FILE
#define COSMS_CORE_FILE #define COSMS_CORE_FILE
void cosms_core_file_read(char *path); typedef enum {
void cosms_core_file_write(char *path); COSMS_FILE_OK = 0,
COSMS_FILE_NOT_FOUND = -1,
} CosmsFileError;
CosmsFileError cosms_core_file_read(char *path);
CosmsFileError cosms_core_file_write(char *path);
#endif #endif

View file

@ -10,10 +10,12 @@
#include <stdio.h> #include <stdio.h>
void cosms_core_file_read(char *path) { CosmsFileError cosms_core_file_read(char *path) {
printf("Hello, World!"); printf("Hello, World!");
return COSMS_FILE_OK;
} }
void cosms_core_file_write(char *path) { CosmsFileError cosms_core_file_write(char *path) {
printf("Hello, World"); printf("Hello, World");
return COSMS_FILE_OK;
} }