Change-Id: Ia3dcb3a82e452fdcf0d087e8cd01ac01ca831c84
Reviewed-on: https://go-review.googlesource.com/132597
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Kevin Burke <kev@inburke.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
import (
"fmt"
"os"
+ "strings"
)
// The Errorf function lets us use formatting features
// Output: user "bueller" (id 17) not found
}
+func ExampleFscanf() {
+ var (
+ i int
+ b bool
+ s string
+ )
+ r := strings.NewReader("5 true gophers")
+ n, err := fmt.Fscanf(r, "%d %t %s", &i, &b, &s)
+ if err != nil {
+ panic(err)
+ }
+ fmt.Println(i, b, s)
+ fmt.Println(n)
+ // Output:
+ // 5 true gophers
+ // 3
+}
+
func ExampleSprintf() {
i := 30
s := "Aug"