Minimized region files reopen

This commit is contained in:
MihailRis
2023-12-21 01:21:15 +03:00
parent 5db4f0961c
commit a9c6b30721
4 changed files with 129 additions and 69 deletions
+14
View File
@@ -3,6 +3,7 @@
#include <string>
#include <vector>
#include <fstream>
#include <filesystem>
#include "../typedefs.h"
@@ -11,6 +12,19 @@ namespace json {
}
namespace files {
/* Read-only random access file */
class rafile {
std::ifstream file;
size_t filelength;
public:
rafile(std::filesystem::path filename);
void seekg(std::streampos pos);
void read(char* buffer, std::streamsize size);
size_t length() const;
};
extern bool write_bytes(std::filesystem::path, const char* data, size_t size);
extern uint append_bytes(std::filesystem::path, const char* data, size_t size);
extern bool read(std::filesystem::path, char* data, size_t size);