[TUHS] V6 Console IO

Paul Riley paul at rileyriot.com
Fri Jul 24 14:41:38 AEST 2020


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 at 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);
>         }
> }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200724/7b5144aa/attachment.htm>


More information about the TUHS mailing list