[TUHS] V6 Console IO

Paul Riley paul at rileyriot.com
Fri Jul 24 14:54:40 AEST 2020


Sorry, I see you used "write".

*Paul Riley*



On Fri, 24 Jul 2020 at 12:41, Paul Riley <paul at 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 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/6186ded6/attachment.htm>


More information about the TUHS mailing list