stdinprompt/example_test.go

23 lines
311 B
Go
Raw Normal View History

2020-02-10 21:07:43 +00:00
package stdinprompt_test
import (
"bytes"
"fmt"
"os"
"src.lwithers.me.uk/go/stdinprompt"
)
func ExampleNew() {
q := make([]byte, 4096)
in := stdinprompt.New()
for {
n, err := in.Read(q)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
os.Stdout.Write(bytes.ToUpper(q[:n]))
}
}