-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfs.h
More file actions
40 lines (34 loc) · 751 Bytes
/
fs.h
File metadata and controls
40 lines (34 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include <fstream>
#define FS_READ ios::in
#define FS_WRITE ios::out
#define FS_BINARY ios::binary
namespace fs
{
class file
{
private:
fstream _stream;
public:
fstream* getStream();
void write(string data);
void writeBinary(const char *data, size_t size);
string read();
void readBinary(char *data, size_t size);
void close();
};
class exception
{
string what_str;
public:
exception(string what);
string what();
};
bool exists(std::string path);
file *open(std::string path, int flags = FS_READ | FS_WRITE);
void writeData(string path, string data);
void safeWriteData(string path, string data);
string readData(string path);
string getRootPath();
void rename(string oldname, string newname);
}