* Seek in the current file. * @param pos New position. * @param mode Type of seek (\c SEEK_CUR means \a pos is relative to current position, \c SEEK_SET means \a pos is absolute). */
| 88 | * @param mode Type of seek (\c SEEK_CUR means \a pos is relative to current position, \c SEEK_SET means \a pos is absolute). |
| 89 | */ |
| 90 | void RandomAccessFile::SeekTo(size_t pos, int mode) |
| 91 | { |
| 92 | if (mode == SEEK_CUR) pos += this->GetPos(); |
| 93 | |
| 94 | this->pos = pos; |
| 95 | if (fseek(*this->file_handle, this->pos, SEEK_SET) < 0) { |
| 96 | Debug(misc, 0, "Seeking in {} failed", this->filename); |
| 97 | } |
| 98 | |
| 99 | /* Reset the buffer, so the next ReadByte will read bytes from the file. */ |
| 100 | this->buffer = this->buffer_end = this->buffer_start; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Read a byte from the file. |
no test coverage detected