FastLED 3.10.8
Loading...
Searching...
No Matches

◆ seek() [2/2]

bool fl::detail::posix_filebuf::seek ( fl::size_t pos,
seek_dir dir )
overridevirtual

Implements fl::filebuf.

Definition at line 124 of file file_handle.cpp.hpp.

124 {
125 if (!mFile) {
127 return false;
128 }
129 int whence = (dir == seek_dir::beg) ? fl::io::seek_set :
130 (dir == seek_dir::cur) ? fl::io::seek_cur : fl::io::seek_end;
131 int result = fl::fseek(mFile, static_cast<long>(pos), whence);
132 if (result != 0) {
133 captureError();
134 return false;
135 }
136 mLastError = 0;
137 return true;
138}
void captureError() FL_NO_EXCEPT
fl::size_t pos() const FL_NO_EXCEPT
constexpr int seek_cur
Definition file_io.h:44
constexpr int err_bad_file
Definition file_io.h:48
constexpr int seek_set
Definition file_io.h:43
constexpr int seek_end
Definition file_io.h:45
seek_dir
Definition file_handle.h:20
int fseek(FILE *file, long offset, int origin) FL_NO_EXCEPT
Set file position.
Definition file_io.h:269
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References fl::beg, captureError(), fl::cur, fl::io::err_bad_file, fl::FL_NO_EXCEPT, fl::fseek(), mFile, mLastError, fl::filebuf::pos(), fl::io::seek_cur, fl::io::seek_end, and fl::io::seek_set.

Referenced by operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: