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);
        }
}