diff options
| author | Alejandro W. Sior <aho@sior.be> | 2023-02-10 19:24:23 +0100 |
|---|---|---|
| committer | Alejandro W. Sior <aho@sior.be> | 2023-02-10 19:24:23 +0100 |
| commit | cd25fe0560f746bedad0d16c173deeaa8db6b562 (patch) | |
| tree | bdf0d8991bbf9e51ed93ba4acc452caa54613d43 /bfs/pio.ha | |
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)?; +}; |
