[gambit-list] |read-char| without #\newline

John Cowan cowan at ccil.org
Wed Sep 4 11:34:10 EDT 2019


The buffering setting has to do with buffering within the Scheme process,
whereas the tty setting has to do with buffering within the operating
system.  In order to get single-character reads from the terminal, you have
to turn off both.

On Wed, Sep 4, 2019 at 10:22 AM Phillip Suero <philsuero at gmail.com> wrote:

> Hello!
>
> I have been trying to get characters on the console without the need to
> press enter using the |read-char| function.
> The section 17.4.1 of Gambit's manual explains that setting the property
> *buffering *of a port should be enough to get chars without #\newline.
> But I wasn't able to make it work with |current-input-port| or
> |console-port|.
>
> (define (getchar)
>   (port-settings-set! (current-input-port) (list buffering: #f))
>   (let loop ()
>     (write-char (read-char (current-input-port)))
>     (loop)))
>
> I have been told that one option is to change my terminal settings to raw
> mode.
> I have also tried to use *telnet* and I was able to make it work properly
> with the
> client on *mode character*.
>
> But, as far as I understand, there should be no need of *telnet* or raw
> terminal mode.
> What am I missing here?
>
> Thanks in advance,
> Phil
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20190904/63bc9e0c/attachment.htm>


More information about the Gambit-list mailing list