29bool write_all(
int file_descriptor,
const char* memory,
size_t length)
34 while (written < length and (returned = write(file_descriptor, memory + written, length - written)) > 0)
36 if (written == length)
38 log_error(
"Unable to write the last %zu bytes out of %zu to file descriptor %i: %s",
39 length - written, length, file_descriptor, strerror(errno));
Simplistic logging utilities.
#define log_error(...)
Report a condition causing the current operation to abort.
Dynamic string implementation.
bool write_all(int file_descriptor, const char *memory, size_t length)
Keep calling write, untill all bytes are written, or write returns an error.
Wrapper arounf the write system call.