io

Read

Takes a slice, and populates with with n values

Returns the number of bytes populated in that slice, and an err

import (
	"fmt"
	"io"
	"strings"
)

func main() {
	str := "this is a string of chars"
	r := strings.NewReader(str)
	b := make([]byte, 8)

	for {
		n, err := r.Read(b)

		if err == io.EOF {
			return
		}

		fmt.Printf("%v, %v, %v\n", n, err, b[:n])
	}
}