lucifer-x-wang
2018-12-17 01:46:06
Is there any function in scheme like “getch()” in C?
notjack
2018-12-17 01:51:10
@lucifer-x-wang There’s a read-char
function: http://docs.racket-lang.org/reference/Byte_and_String_Input.html#(def._((quote._~23~25kernel)._read-char))
lucifer-x-wang
2018-12-17 02:13:05
But in this way the char will still be displayed on the screen.
greg
2018-12-17 02:36:53
@lucifer-x-wang For simple press-a-key you could probably use (read-byte)
or (integer->char (read-byte))
. For less simple things you could look at the char-term package: https://pkgd.racket-lang.org/pkgn/search?q=charterm
greg
2018-12-17 02:38:45
AFAICT char-term is using read-byte
at root. But also trying to wrap that in “terminal” ideas — which may be useful to you, or, just complexity you don’t need. idk. I don’t have much experience using Racket for that.