From: Larry McVoy <lm@mcvoy.com>
To: Paul Riley <paul@rileyriot.com>
Cc: tuhs <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] V6 Console IO
Date: Fri, 24 Jul 2020 07:01:38 -0700 [thread overview]
Message-ID: <20200724140138.GD11199@mcvoy.com> (raw)
In-Reply-To: <CAD05_j2Y=0AJWdwZbQONbt-bxjbhdQqmmuoFeorCVzyC3XnD-g@mail.gmail.com>
Yeah, write is unbuffered though I think Noel is correct, it's going to
a tty and the tty will buffer until \n
So you probably have to set the tty in raw mode (sorry that I'm vague,
I never ran V6).
On Fri, Jul 24, 2020 at 12:54:40PM +0800, Paul Riley wrote:
> Sorry, I see you used "write".
>
> *Paul Riley*
>
>
>
> On Fri, 24 Jul 2020 at 12:41, Paul Riley <paul@rileyriot.com> wrote:
>
> > Larry,
> >
> > Thanks for that. The documentation for putchar says that it only puts the
> > low byte of the argument, so I assume that passing an int is ok.
> >
> > Paul
> >
> > *Paul Riley*
> >
> >
> > On Fri, 24 Jul 2020 at 10:57, Larry McVoy <lm@mcvoy.com> wrote:
> >
> >> > int main() {
> >> > int c;
> >> > while ((c = getchar()) != EOF) {
> >> > putchar(c);
> >> > }
> >> > }
> >>
> >> int
> >> main()
> >> {
> >> int c;
> >> char C;
> >>
> >> while ((c = getchar()) != EOF) {
> >> C = c;
> >> write(1, &C, 1);
> >> }
> >> }
> >>
> >
--
---
Larry McVoy lm at mcvoy.com http://www.mcvoy.com/lm
next prev parent reply other threads:[~2020-07-24 14:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 0:18 Paul Riley
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 [this message]
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=20200724140138.GD11199@mcvoy.com \
--to=lm@mcvoy.com \
--cc=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).