"Kagamin" <[email protected]> wrote in message
news:[email protected]...
> Nick Sabalausky Wrote:
>
>> Something else interesting to note for anyone who didn't already know
>> (like
>> me), is that if you change the body of execA's main to:
>>
>> write("In A"); // Note this doesn't automatically flush
>> system("execB");
>>
>> Then the output is backwards (on either Windows or Linux):
>>
>> In B
>> In A
>
> To get expected behavior adjust console buffering with setvbuf and use
> system();
setvbuf is new to me, I'll have to look that up. I was just pointing out
that streams need to be flushed before calling system() or stuff could end
up out-of-order in windows. This works fine:
write("In A"); // Note this doesn't automatically flush
stdout.flush();
system("execB");