8#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64) || defined(__WIN64__)
12#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNUC__) || defined(__GNUG__) || defined(unix) || defined(__unix) || defined(__unix__)
17#error OS not supported
21#define fopen_s(pFile,filename,mode) ((*(pFile))=fopen((filename),(mode)))==NULL
42 File(
const char* str,
const char* mode);
55 bool open(
const char* str,
const char* mode);
70 size_t write(
void* buf,
size_t len);
78 size_t read(
void* buf,
size_t len);
85 size_t read(
unsigned char** p_buf);
93 bool gets(
char* str,
size_t len);
A class for file reading and writing.
Definition: File.h:30
size_t print(const char *str)
Print a string.
File(const char *str, const char *mode)
Constructor.
bool open(const char *str, const char *mode)
Open the file.
bool _isOpen
true if file is open
Definition: File.h:115
bool gets(char *str, size_t len)
Get a string.
bool eof()
Check end-of-file.
void close()
Clone the file.
size_t read(void *buf, size_t len)
Read a buffer.
FILE * p_file
Pointer to the C-type file.
Definition: File.h:114
size_t read(unsigned char **p_buf)
Read all the file.
size_t write(void *buf, size_t len)
Write a buffer.
bool isOpen()
Check if open.
Definition: File.h:104