Noel,
Thanks for your reply.
I had suspected that the Unix behaviour was responsible, and you've made
that clear with the "line at a time" assertion. I tried removing echo in
STTY, but haven't tried raw.
Paul
*Paul Riley*
Mo: +86 186 8227 8332
Email: paul(a)rileyriot.com
On Fri, 24 Jul 2020 at 10:28, Noel Chiappa <jnc(a)mercury.lcs.mit.edu> wrote:
From: Paul
Riley
I'm struggling however with how C processes
the IO. It seems that
when I
type at the console, my typing is immediately
echoed to my terminal
window. ... nothing appears on the terminal until I press enter,
when
the system displays the whole line of input ...
How
can I suppress the original C/Unix echo, and get my output to appear
immediately?
This is not a C issue; it's the Unix I/O system (and specifically,
terminal I/O).
Normally, Unix terminal input is done line-at-a-time: i.e. the read() call
to
the OS (whether for 1 character, or a large number) doesn't return until an
enire line has been typed, and [Retrurn] has been hit; then the entire
line is
available. While it's being buffered by the OS, echoing is done, and rubout
processing is also performed.
One can suppress all this; there's a mode call 'raw' (the normal mode is
sometime labelled 'cooked') which suppresses all that, and just gives one
the
characters actually typed, as they are typed. The stty() system call can be
used to turn this on.
See the V6 tty(IV) manual entry for more. stty() is in stty(II).
Noel