MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / fseek

Method fseek

source/core/StarFile_unix.cpp:213–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void File::fseek(void* f, StreamOffset offset, IOSeek seekMode) {
214 auto fd = fdFromHandle(f);
215 int retCode;
216 if (seekMode == IOSeek::Relative)
217 retCode = lseek(fd, offset, SEEK_CUR);
218 else if (seekMode == IOSeek::Absolute)
219 retCode = lseek(fd, offset, SEEK_SET);
220 else
221 retCode = lseek(fd, offset, SEEK_END);
222
223 if (retCode < 0)
224 throw IOException::format("Seek error: {}", strerror(errno));
225}
226
227StreamOffset File::ftell(void* f) {
228 return lseek(fdFromHandle(f), 0, SEEK_CUR);

Callers

nothing calls this directly

Calls 2

fdFromHandleFunction · 0.85
formatFunction · 0.70

Tested by

no test coverage detected