FastLED 3.9.15
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}
fl::size_t pos() const
constexpr int seek_cur
Definition file_io.h:41
constexpr int err_bad_file
Definition file_io.h:45
constexpr int seek_set
Definition file_io.h:40
constexpr int seek_end
Definition file_io.h:42
int fseek(FILE *file, long offset, int origin)
Set file position.
Definition file_io.h:266
seek_dir
Definition file_handle.h:19
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::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: