Commit f095ceec authored by Tom Niget's avatar Tom Niget

Add file.write

parent c208290e
......@@ -145,6 +145,14 @@ struct {
buf.resize(nbytes);
co_return std::move(buf);
})
METHOD(
typon::Task<int>, write, (const std::string &buf), const {
int nbytes = co_await typon::io::write(self->fd, buf);
if (nbytes < 0) {
system_error(-nbytes, "write()");
}
co_return nbytes;
})
METHOD(
typon::Task<void>, close, (),
const { co_await typon::io::close(self->fd); })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment