go - golang reading long text from stdin -
i want read long text os.stdin, can't make happen. read in subject, tried codes supposed work. every method cuts after 4096 characters, no matter what.
eg. here's working example. after first run of loop, reads first 4096 characters, , waits more processing each enter, until end eof (ctrl+d). same thing fmt.scan, bufio.newscanner, bufio readline, ioutil.readall. if save file, , read it, works expected. stdin doesn't.
i'm on arch linux, 32 bit, go 1.7, tested in mate-terminal 1.14, tty 8.25, same thing in both of them. , same thing happens on hackerrank.com page, don't know technology they're using.
please help!
edit:
my input little bit longer 4096 characters. checked out link amd shared, , got following: input 1 line containing space separated integers. when changed spaces newlines, worked. since excercise format on hackerrate uses long space-separated lines, problem still up, refinement.
i able solve ian lance taylor: https://groups.google.com/forum/#!topic/golang-nuts/ndh-1wdswys
so 4096 characters limit of system through n_tty_buf_size kernel parameter. same thing worked cat , python well.
anyway, on hackerrank.com able solve same exercise in python, guess have wrong configuration go, asked them find out.
Comments
Post a Comment