BinaryReader: add a way to seek into the file.

This commit is contained in:
Guillaume Jacquemin 2022-02-14 09:31:20 +01:00
parent 76210e147a
commit 975f471a68
2 changed files with 6 additions and 0 deletions

View file

@ -45,6 +45,10 @@ auto BinaryReader::position() -> Long {
return _ftelli64(_file); return _ftelli64(_file);
} }
auto BinaryReader::seek(Long position) -> bool {
return _fseeki64(_file, position, SEEK_SET) == 0;
}
void BinaryReader::closeFile() { void BinaryReader::closeFile() {
std::fclose(_file); std::fclose(_file);
_file = nullptr; _file = nullptr;

View file

@ -36,6 +36,8 @@ class BinaryReader {
auto eof() -> bool; auto eof() -> bool;
auto position() -> Long; auto position() -> Long;
auto seek(Long position) -> bool;
void closeFile(); void closeFile();
auto readChar(char& value) -> bool; auto readChar(char& value) -> bool;