diff options
Diffstat (limited to 'src/io/write.cpp')
-rw-r--r-- | src/io/write.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/io/write.cpp b/src/io/write.cpp index 5993a69..833b173 100644 --- a/src/io/write.cpp +++ b/src/io/write.cpp @@ -18,16 +18,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#include <sys/uio.h> - #include <fcntl.h> -#include <unistd.h> +#include <cstdio> +#include <cstdlib> + +#include <algorithm> + +#include "../strings/zstring.hpp" #include "../strings/xstring.hpp" #include "../poison.hpp" +namespace tmwa +{ namespace io { WriteFile::WriteFile(FD f, bool linebuffered) @@ -36,6 +41,9 @@ namespace io WriteFile::WriteFile(ZString name, bool linebuffered) : fd(FD::open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)), lb(linebuffered), buflen(0) {} + WriteFile::WriteFile(const DirFd& dir, ZString name, bool linebuffered) + : fd(dir.open_fd(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)), lb(linebuffered), buflen(0) + {} WriteFile::~WriteFile() { if (fd != FD()) @@ -174,3 +182,4 @@ namespace io return len; } } // namespace io +} // namespace tmwa |