|
|
Message-ID: <20160210232232.GN9915@port70.net>
Date: Thu, 11 Feb 2016 00:22:32 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: Enforcing expected ordering of operations on stdout,
stdin, and stderr
* Max Ruttenberg <mruttenberg@...technology.com> [2016-02-10 18:08:47 -0500]:
> Consider this program:
>
> int main()
> {
> char buff[2];
> puts("enter a character");
> buff[0] = getchar();
> buff[1] = '\0';
> puts(buff);
> return 0;
> }
>
> If I compile that on linux-amd64, with or without musl, I will see "enter a
> character" printed to my console and then be prompted for a character, as
> opposed to the other way around. I don't know if this is formally
> guaranteed by the C standard, but somehow that order seems to be
> maintained.
>
that is line buffering of stdout on interactive terminals
if you pipe it to cat then there will be no line buffering.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.