How to read the keyboard when stdin redirected

Dejan Lekic dejan.lekic at gmail.com
Thu May 14 11:28:14 UTC 2026


On Wednesday, 13 May 2026 at 17:40:49 UTC, Darren Drapkin wrote:
> As part of a course on Computing, I am trying to create a cut 
> down version of GNU _more_.  I need it to read the keyboard 
> when stdin is redirected at the end of a pipeline. This happens 
> when _more_ outputs a screen full and prompts the user to 
> scroll the screen.
> Yours &c.
> Darren Drapkin

When I was gathering knowledge for my TUI library (not yet 
public) I wrote this as part of the learning process: 
https://rpa.st/3MUT2

Unfortunately this code is very old, I was lucky to find it. 
However it does demonstrate how to enter the "uncooked" (raw) 
mode, and then go back at the end. You do need to have some sort 
of loop to deal with all the data (control codes, as well as the 
actual data) that come from the terminal.

I suggest you read carefully at least the first two links from 
that source file as they contain everything you need to know.


More information about the Digitalmars-d-learn mailing list