mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
19 lines
242 B
V
19 lines
242 B
V
module io
|
|
|
|
const (
|
|
buf_max_len = 1024
|
|
)
|
|
|
|
pub fn cp(dst Writer, src Reader) ? {
|
|
mut buf := []byte{len: buf_max_len}
|
|
for {
|
|
len := src.read(mut buf) or { break }
|
|
dst.write(buf[..len]) or {
|
|
return err
|
|
}
|
|
}
|
|
unsafe {
|
|
buf.free()
|
|
}
|
|
}
|