Created
April 24, 2015 18:03
-
-
Save 178inaba/8d485fe3aa556e235eca to your computer and use it in GitHub Desktop.
Macだと標準入力の最大文字数は1024文字(?) ref: http://qiita.com/inaba178/items/81ea3c2f763b45e7e3bc
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" | |
) | |
func main() { | |
scanner := bufio.NewScanner(os.Stdin) | |
for scanner.Scan() { | |
fmt.Println(scanner.Text()) // Println will add back the final '\n' | |
} | |
if err := scanner.Err(); err != nil { | |
fmt.Fprintln(os.Stderr, "reading standard input:", err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment