aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/io/io.v
blob: c07e074b7161e4f9559df43b262436198ee7f3f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module io

const (
	buf_max_len = 1024
)

pub fn cp(src Reader, mut dst Writer) ? {
	mut buf := []byte{len: io.buf_max_len}
	for {
		len := src.read(mut buf) or { break }
		dst.write(buf[..len]) or { return err }
	}
	unsafe {
		buf.free()
	}
}