From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9298 Path: news.gmane.org!not-for-mail From: Joakim Sindholt Newsgroups: gmane.linux.lib.musl.general Subject: Re: Enforcing expected ordering of operations on stdout, stdin, and stderr Date: Wed, 10 Feb 2016 23:05:01 +0100 Message-ID: <1455141901.26335.95.camel@zhasha.com> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1455141916 6199 80.91.229.3 (10 Feb 2016 22:05:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Feb 2016 22:05:16 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9311-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 10 23:05:16 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aTcst-0000w8-QZ for gllmg-musl@m.gmane.org; Wed, 10 Feb 2016 23:05:16 +0100 Original-Received: (qmail 14322 invoked by uid 550); 10 Feb 2016 22:05:13 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 14296 invoked from network); 10 Feb 2016 22:05:13 -0000 In-Reply-To: X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Xref: news.gmane.org gmane.linux.lib.musl.general:9298 Archived-At: On Wed, 2016-02-10 at 16:49 -0500, Max Ruttenberg wrote: > All, > > > I guess my question is more easily asked through an example. If I have > code that makes a call to puts and then a call to getchar, what > mechanism enforces that stdout gets flushed before blocking for stdin? > Is there a such a mechanism? My gut says yes but I haven't been able > to pinpoint it. > > > Thanks, > Max fflush(stdout); This is more of a basic C thing than a libc ml thing. You should consider picking up a copy of The C Programming Language by Kernighan and Ritchie. It will explain all of this.