You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 rivejä
523 B

#pragma once
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h>
namespace os{
constexpr auto write = [](int32_t fd, const char* ptr, int64_t size){
do
{
auto check = ::write(fd, ptr, size);
if(check<0)
{
return check;
}
size-=check;
ptr+=check;
}while(size!=0);
return size;
};
constexpr auto stdout_write = [](const char* ptr, size_t size){
return write(0, ptr, size);
};
constexpr auto stderr_write = [](const char* ptr, size_t size){
return write(2, ptr, size);
};
}