From: Paul Riley <paul@rileyriot.com>
To: tuhs <tuhs@minnie.tuhs.org>
Subject: [TUHS] V6 Console IO
Date: Fri, 24 Jul 2020 08:18:26 +0800 [thread overview]
Message-ID: <CAD05_j1H76SDy_c0WyWXCHgiAfnEzVYFxDtrq1x=f7OZAhAXfg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]
I am using C in V6 to create a Forth compiler. I don;t have any interest in
Forth as a general purpose language, however I do like it. It's satisfying
to create a language from the ground up. I'm interested in it a simple and
extensible interpreted language for toying with my PDP-11s, so I'll have
some with it in the future.
I have a very basic problem. I am simply using getchar and putchar for
console IO, which is convenient indeed. 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. When I press backspace the system
responds with the character that was deleted, which is fine, as I assume it
was from the paper teletype days. However, my code is receiving input and
also echoing the output, but nothing appears on the terminal until I press
enter, when the system displays the whole line of input, which is
essentially a duplicate of what the terminal originally displayed, but with
the consolidated edits. My code is reading and echoing the input character
by character.
Here's my question. How can I suppress the original C/Unix echo, and get my
output to appear immediately? This simple sample code form the C
programming manual behaves the same.
int main() {
int c;
while ((c = getchar()) != EOF) {
putchar(c);
}
}
Paul
*Paul Riley*
Mo: +86 186 8227 8332
Email: paul@rileyriot.com
[-- Attachment #2: Type: text/html, Size: 1975 bytes --]
next reply other threads:[~2020-07-24 1:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 0:18 Paul Riley [this message]
2020-07-24 2:57 ` Larry McVoy
2020-07-24 4:41 ` Paul Riley
2020-07-24 4:54 ` Paul Riley
2020-07-24 14:01 ` Larry McVoy
2020-07-24 2:28 Noel Chiappa
2020-07-24 4:54 ` Paul Riley
2020-07-24 16:37 ` Random832
2020-07-24 17:15 ` Clem Cole
2020-07-25 2:45 ` Random832
2020-07-24 14:34 ` Clem Cole
2020-07-25 2:48 ` Paul Riley
2020-07-25 4:02 ` John Cowan
2020-07-25 15:09 ` Clem Cole
2020-07-25 15:31 ` Richard Salz
2020-07-26 1:08 ` Random832
2020-07-27 9:11 ` Paul Riley
2020-07-24 14:33 Noel Chiappa
2020-07-24 14:36 ` Clem Cole
2020-07-25 1:53 ` Dave Horsfall
2020-07-25 17:45 Noel Chiappa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAD05_j1H76SDy_c0WyWXCHgiAfnEzVYFxDtrq1x=f7OZAhAXfg@mail.gmail.com' \
--to=paul@rileyriot.com \
--cc=tuhs@minnie.tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).