I need to read user input from console. Sounds pretty easy, but I need to get it without user pressing “Enter” key. It should be possible. Please help me.
Hi @Tigran_Kashapov welcome to the community!
While I have not tried to stream data from the terminal into a Go program I did find the link below after a little searching. I wish I could be a better help but hopefully this will at least get you on the right path to solving your problem.
ok, thanks a lot. I’ll try this right now
Let me know if you get it working! I’d love to learn.
Unfortunately, It isn’t working
I solved this problem via library called “keyboard”. (github.com/eiannone/keyboard)
Hi,
Most of the time, when you think keyboard you mean standard input. You could avoid using a third party library with something explained here under the section “Reading Single UTF-8 Encoded Unicode Characters”.
The idea is to use a Reader to read runes from standard input.
Have a nice day.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.