Created
April 17, 2016 14:07
-
-
Save asm-jaime/ddc7d40d042720aa74a23f724bca7428 to your computer and use it in GitHub Desktop.
test scanner writer interface bufio package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
) | |
var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin) | |
var writer *bufio.Writer = bufio.NewWriter(os.Stdout) | |
func main() { | |
defer writer.Flush() | |
scanner.Scan() | |
str_slice := scanner.Text() | |
writer.WriteString(str_slice + "\n") | |
fmt.Print(str_slice) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment