Home > other >  A magical little program, a great god to explain!
A magical little program, a great god to explain!

Time:09-22

Func main () {
Buf:=make (byte [], 1024)
For {
Len, err:=OS. Stdin. Read (buf)
If err! Nil={
Return
}
FMT. Println (len, string (buf [: len]))
}
}

Using goland click on the run, the results are as follows:
Qweasd
1 q
6 weasd
Why can separate two times to print? And for the first time print will only print one character at a time, will now!

CodePudding user response:

I run this program would not have such, JetBrains GoLand 2019.2.3 x64

CodePudding user response:

Can be produced by the enter key on the Windows is caused by "\ r \ n", you didn't this problem on Linux
Next:Mysql
  • Related