It's unexplainable...

Peter Jones peterj at swanee.ee.uwa.oz.au
Thu Jan 31 17:34:04 AEST 1991


In <1991Jan30.203605.14481 at bronze.ucs.indiana.edu>
    speelmo at 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 <stdio.h>

>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).



More information about the Comp.lang.c mailing list