10 throw std::ios_base::failure(
"AutoFile::read: file handle is nullptr");
17 throw std::ios_base::failure(
feof() ?
"AutoFile::read: end of file"
18 :
"AutoFile::read: fread failed");
24 throw std::ios_base::failure(
25 "AutoFile::ignore: file handle is nullptr");
29 size_t nNow = std::min<size_t>(nSize,
sizeof(data));
30 if (std::fread(data, 1, nNow,
m_file) != nNow) {
31 throw std::ios_base::failure(
32 feof() ?
"AutoFile::ignore: end of file"
33 :
"AutoFile::ignore: fread failed");
41 throw std::ios_base::failure(
"AutoFile::write: file handle is nullptr");
44 throw std::ios_base::failure(
"AutoFile::write: write failed");
void ignore(size_t nSize)
void read(Span< std::byte > dst)
std::size_t detail_fread(Span< std::byte > dst)
Implementation detail, only used internally.
void write(Span< const std::byte > src)
A Span is an object that can refer to a contiguous sequence of objects.
constexpr std::size_t size() const noexcept
constexpr C * data() const noexcept