|
|
- #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);
- };
-
- }
|