From cd25fe0560f746bedad0d16c173deeaa8db6b562 Mon Sep 17 00:00:00 2001 From: "Alejandro W. Sior" Date: Fri, 10 Feb 2023 19:24:23 +0100 Subject: initial commit --- bfs/pio.ha | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bfs/pio.ha (limited to 'bfs/pio.ha') diff --git a/bfs/pio.ha b/bfs/pio.ha new file mode 100644 index 0000000..c333d3d --- /dev/null +++ b/bfs/pio.ha @@ -0,0 +1,13 @@ +use io; + +// Reads from a stream into a buffer at specified offset +fn pread(s: io::handle, buf: []u8, off: io::off) (size | io::EOF | io::error) = { + io::seek(s, off, io::whence::SET)?; + return io::read(s, buf)?; +}; + +// Writes into a stream from a buffer at specified offset +fn pwrite(s: io::handle, buf: const []u8, off: io::off) (size | io::error) = { + io::seek(s, off, io::whence::SET)?; + return io::write(s, buf)?; +}; -- cgit v1.2.3