2010/8/15 Richard Mittel <[email protected]>:
> I'm trying to get read-char to read a character as soon as it is typed, but
> read-char insists on buffering the input until a carriage return is
> entered.  The Racket reference says that the buffer mode is controlled by
> file-stream-buffer-mode, but it seems to have no effect.  (More confusingly,
> the doc says that line buffering, which I think is the behavior I'm seeing,
> is not allowed on input ports.)
> [...]

Hello Richard,

at least in Unix environments, line buffering of direct user input is
usually done by the terminal device, ie. at a stage in the pipeline
before the Racket interpreter ever gets to see the input.

To change this behaviour, your program would have to call tcsetattr(3)
from the POSIX C library or invoke the external utility program
stty(1) on the terminal file descriptor before reading input from it.

Some time ago I wrote a small module that can do the latter, which I
attach to this message for your reference.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.

Attachment: terminal.ss
Description: Binary data

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to