40 bool Open(
const std::string &file)
43 m_file = fopen(file.c_str(),
"rb");
44 return NULL != m_file;
47 bool OpenForWrite(
const std::string &file,
bool overwrite)
50 m_file = fopen(file.c_str(),
"wb");
51 return NULL != m_file;
60 uint64_t Read(
void *data, uint64_t size)
62 if (fread(data, (
size_t)size, 1, m_file) == 1)
67 uint64_t Write(
const void *data, uint64_t size)
69 if (fwrite(data, (
size_t)size, 1, m_file) == 1)
79 uint64_t GetFileSize()
81 long curPos = ftell(m_file);
82 uint64_t fileSize = 0;
83 if (fseek(m_file, 0, SEEK_END) == 0)
85 long size = ftell(m_file);
87 fileSize = (uint64_t)size;
96 uint64_t Seek(uint64_t offset)
98 uint64_t seekedBytes = 0;
99 int seekRet = fseek(m_file, offset, SEEK_SET);
101 seekedBytes = offset;
Definition: SimpleFS.h:27