13 #ifndef __STOUT_OS_WRITE_HPP__
14 #define __STOUT_OS_WRITE_HPP__
36 namespace signal_safe {
42 while (offset < count) {
47 int error = WSAGetLastError();
69 return write_impl(fd, message, std::strlen(message));
75 return write_impl(fd, message.data(), message.length());
79 template <
typename T,
typename... Args>
87 return write(fd, args...);
115 return ErrnoError(
"Failed to open file '" + path +
"'");
133 return write(std::string(path), message);
139 #endif // __STOUT_OS_WRITE_HPP__
SSIZE_T ssize_t
Definition: windows.hpp:192
#define O_WRONLY
Definition: fcntl.hpp:26
Definition: nothing.hpp:16
#define O_TRUNC
Definition: fcntl.hpp:29
const mode_t S_IRGRP
Definition: windows.hpp:319
#define O_CLOEXEC
Definition: fcntl.hpp:31
ssize_t write(const WindowsFD &fd, const void *data, size_t size)
Definition: write.hpp:29
const mode_t S_IWUSR
Definition: windows.hpp:312
Definition: errorbase.hpp:49
#define O_CREAT
Definition: fcntl.hpp:28
const mode_t S_IRUSR
Definition: windows.hpp:311
bool is_restartable_error(int error)
Definition: socket.hpp:33
Try< Nothing > close(int fd)
Definition: close.hpp:24
ssize_t write_impl(int_fd fd, const char *buffer, size_t count)
Definition: write.hpp:38
bool isError() const
Definition: try.hpp:71
Try< int_fd > open(const std::string &path, int oflag, mode_t mode=0)
Definition: open.hpp:39
std::string error(const std::string &msg, uint32_t code)
int int_fd
Definition: int_fd.hpp:35
const mode_t S_IROTH
Definition: windows.hpp:327
const T & get() const
Definition: try.hpp:73
ssize_t write(int_fd fd, const char *message)
Definition: write.hpp:66