Re: A problem with read-char



On Jun 6, 6:54 pm, meta.per...@xxxxxxxxx wrote:
Hi.

Is it possible to make read-char behave like getch in ó when working
with interactive stream (*standard-input*)?
In SBCL read-char wants "enter" key to unhang from REPL, in C getchar
returns immediately after user press key on keyboard.
Probably is possible to run code that uses read-char with direct
console access, aside REPL?
C's getchar() reads and returns one byte from the stdin file stream.
stdin needs not to be your terminals input; Sometimes a terminal just
isn't there.
(same applies for *standard-input*)
In C & Common Lisp any read from a file stream may block;
If the ISO group on C (or the ANSI on common lisp) had standarized a
function similar to curses getch(), the portability of these languages
would get more limitted.
Thus, such function does not exist in either language.
Since you want to do something that might not be portable to a
microcontroller (but the benifit is the much more enhanced UI), use a
non-standard library, such as CL-ncurses.
<http://common-lisp.net/project/cl-ncurses/>
.