mirror of
https://github.com/golang/go
synced 2024-11-25 06:57:58 -07:00
bufio: add Writer example
Update #5530 R=golang-dev, r CC=golang-dev https://golang.org/cl/12504044
This commit is contained in:
parent
6b706cf50d
commit
8eb8ad2454
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user