4 ms·
1. You can have an interactive program in the pipeline, for example 'less' is usually called this way: cat some.file | less Less reads 'stdin' and then reac
by Mikhail_Edoshin 6y ago
1. You can have an interactive program in the pipeline, for example 'less' is usually called this way:
cat some.file | less
Less reads 'stdin' and then reaches out to the actual console to respond to navigation keys. The console is reachable either via '/dev/tty' (POSIX) or, on Windows, via CreateFile()[1].
But yes, most programming tutorials (and probably many programs) make no distinction between the console and standard streams, hence the confusion. They absolutely should.
[1] https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#consoles https://docs.microsoft.com/en-us/windows/win32/api/fileapi/n...