Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!uniwa!swanee!peterj From: peterj@swanee.ee.uwa.oz.au (Peter Jones) Newsgroups: comp.lang.c Subject: Re: It's unexplainable... Message-ID: Date: 31 Jan 91 06:34:04 GMT References: <1991Jan30.203605.14481@bronze.ucs.indiana.edu> Sender: news@swanee.ee.uwa.oz Organization: Elec Eng, Univ of Western Australia Lines: 20 In <1991Jan30.203605.14481@bronze.ucs.indiana.edu> speelmo@bronze.ucs.indiana.edu (Lance Speelmon - UCS) writes: >Would anyone please explain to me why my output is not what I am expecting... >% cat foo.c >#include >void main(void){ > printf("The date is: "); > system("date"); > printf("\n"); >} >% a.out >Wed Jan 30 15:16:17 EST 1991 >The date is: There are two processes running here, one is the "foo" program and the other is the "date" program. It will depend on the scheduling what actually happens - I guess. It would need "foo" to either flush its output buffer or to do an input or to write to "stderr" (& not be buffered).