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(a)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(a)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