diff options
Diffstat (limited to 'bfs/pio.ha')
| -rw-r--r-- | bfs/pio.ha | 13 |
1 files changed, 13 insertions, 0 deletions
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)?; +}; |
