File input/output: Difference between revisions

Content added Content deleted
Line 2,524: Line 2,524:


=={{header|Snabel}}==
=={{header|Snabel}}==
Reads the entire file into into a list of buffers before writing and returns number of bytes written.
Non-blocking solution with fixed size buffers and coroutines, comparable performance to shell cp. Returns total size.
<lang snabel>
let: q io-queue;
'in' rfile read {@q $1 push _} for
0 'out' rwfile @q write $1 _ &+ for
</lang>

Alternative solution for large files with comparable performance to shell cp; also returns number of bytes written.
<lang snabel>
<lang snabel>
proc: do-write {(
proc: do-write {(