Commit 8eb8ad24 authored by Andrew Gerrand's avatar Andrew Gerrand

bufio: add Writer example

Update #5530

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12504044
parent 6b706cf5
......@@ -12,6 +12,14 @@ import (
"strings"
)
func ExampleWriter() {
w := bufio.NewWriter(os.Stdout)
fmt.Fprint(w, "Hello, ")
fmt.Fprint(w, "world!")
w.Flush() // Don't forget to flush!
// Output: Hello, world!
}
// The simplest use of a Scanner, to read standard input as a set of lines.
func ExampleScanner_lines() {
scanner := bufio.NewScanner(os.Stdin)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment