I am running the dup1 example from The Go Programming Language book (related code shown below):
for input.Scan() {
counts[input.Text()]++
}
After typing some lines of text, I want to terminate the Scan()
method. I've tried Ctrl+D, Ctrl+Z and many other key combinations without luck. Only Ctrl+C works but that also terminates the program.
How can I terminate the Scan()
from terminal without exiting the program?
I am developing on Windows 7 using os.Stdin.
[Edit]
Ctrl+Z
doesn't work:
Thanks. But that doesn't work for me:
C:\prj\src\gopl\>go run dup1.go
I have tried all these combinations from the terminal
^Z
^X
^V
^B
^N
^A
^D
^F
^G
^K
^L
^Q
^W
^E
^R
^T
^Y
^U
^O
^P
2(Notes: only Ctrl + C works here)
C:\prj\src\gopl\>
If I run this program in Ubuntu, only Ctrl + D
works, Ctrl + Z
will Stop the program and Ctrl + C
will terminate it.