cosms-core/include/cosms-core/file.h

31 lines
1 KiB
C

/*
* Copyright (C) Tristan Franssen, <tristanfranssen@strawhats.nl>.
*
* This software is licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License in the file LICENSE or at
* http://www.apache.org/licenses/LICENSE-2.0
*/
#ifndef COSMS_CORE_FILE
#define COSMS_CORE_FILE
#include <stdbool.h>
typedef enum {
COSMS_FILE_OK = 0,
COSMS_FILE_NOT_FOUND = -1,
COSMS_FILE_NO_ACCESS = -2,
COSMS_FILE_LIMIT_REACHED = -3,
COSMS_FILE_COULD_NOT_READ_SIZE = -4,
COSMS_FILE_UNKOWN_ERROR = -5,
COSMS_FILE_FAILED_TO_ALLOCATE = -6,
COSMS_FILE_FAILED_TO_READ = -7,
COSMS_FILE_FAILED_TO_WRITE = -8,
} CosmsFileError;
CosmsFileError cosms_core_file_read(const char *path, char **content, unsigned long long *size);
CosmsFileError cosms_core_file_write(const char *path, const char *content, unsigned long long size, bool override);
const char *cosms_core_file_error_string(CosmsFileError error);
#endif