file_openOrCreateReadWrite
This commit is contained in:
@@ -30,12 +30,12 @@
|
||||
#define path_notseps "\\"
|
||||
#endif
|
||||
|
||||
/// @brief removes part of path after path_sep
|
||||
/// @return str with data = path.data
|
||||
/// @brief removes part of path after path_sep (including path_sep)
|
||||
/// @return pointer to a segment of path.data or "." if no path_sep has been found
|
||||
str path_dirname(str path);
|
||||
|
||||
/// @brief removes part of path before path_sep
|
||||
/// @return str with data = path.data
|
||||
/// @brief removes part of path before path_sep (including path_sep)
|
||||
/// @return pointer to a segment of path.data or path itself if no path_sep has been found
|
||||
str path_basename(str path, bool remove_ext);
|
||||
|
||||
|
||||
@@ -43,19 +43,23 @@ str path_basename(str path, bool remove_ext);
|
||||
// FILE //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// open a file for reading
|
||||
#define FO_Read "rb"
|
||||
/// (re)create a file for writing
|
||||
#define FO_Write "wb"
|
||||
/// opens file for writing additional data to the end / creates new file
|
||||
#define FO_Append "ab"
|
||||
/// (re)creates file for reading/writing
|
||||
#define FO_ReadWrite "w+b"
|
||||
/// opens file for readng/writing additional data to the end / creates new file
|
||||
#define FO_ReadAppend "a+b"
|
||||
/// open file for reading
|
||||
#define FO_ReadExisting "rb"
|
||||
/// (re)create file for writing
|
||||
#define FO_WriteNew "wb"
|
||||
/// open or create file for writing data to the end
|
||||
#define FO_AppendOrCreate "ab"
|
||||
/// open file for reading and writing
|
||||
#define FO_ReadWriteExisting "rb+"
|
||||
/// (re)create file for reading/writing
|
||||
#define FO_ReadWriteNew "wb+"
|
||||
/// open or create file for readng and writing data to the end
|
||||
#define FO_ReadAppend "ab+"
|
||||
|
||||
Result(FILE*) file_open(cstr file_name, cstr fopen_mode);
|
||||
|
||||
/// if file exists, opens it with "rb+", else creates it with "wb+"
|
||||
Result(FILE*) file_openOrCreateReadWrite(cstr file_name);
|
||||
|
||||
bool file_exists(cstr path);
|
||||
Result(i64) file_getSize(FILE* f);
|
||||
|
||||
@@ -10,6 +10,7 @@ extern "C" {
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef int8_t i8;
|
||||
typedef uint8_t u8;
|
||||
|
||||
Reference in New Issue
Block a user