1 #ifndef SILICIUM_WRITE_HPP
2 #define SILICIUM_WRITE_HPP
15 std::size_t total_written = 0;
20 assert(std::numeric_limits<decltype(total_written)>::max() >= std::numeric_limits<decltype(written)>::max());
21 DWORD
const piece =
static_cast<DWORD
>(std::min(
22 static_cast<std::size_t>(std::numeric_limits<DWORD>::max()),
23 data.
size() - total_written
25 if (!WriteFile(file, data.
begin() + total_written, piece, &written,
nullptr))
30 ssize_t
const written =
::write(file, data.
begin() + total_written, data.
size() - total_written);
40 total_written += written;
42 while (total_written < static_cast<std::size_t>(data.
size()));
BOOST_CONSTEXPR Iterator const & begin() const BOOST_NOEXCEPT
Definition: iterator_range.hpp:61
Definition: absolute_path.hpp:19
Definition: iterator_range.hpp:26
SILICIUM_USE_RESULT error_or< std::size_t > write(native_file_descriptor file, memory_range data)
Definition: write.hpp:13
Definition: error_or.hpp:48
SILICIUM_USE_RESULT boost::system::error_code get_last_error()
Definition: get_last_error.hpp:16
#define SILICIUM_USE_RESULT
Definition: config.hpp:147
BOOST_CONSTEXPR difference_type size() const BOOST_NOEXCEPT
Definition: iterator_range.hpp:78