digitalmars.D - Re: Windows command line and execv
- Kagamin <spam here.lot> Aug 20 2010
- Kagamin <spam here.lot> Aug 20 2010
- "Nick Sabalausky" <a a.a> Aug 20 2010
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();
Aug 20 2010
Kagamin Wrote: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();
system() is also a C standard function.
Aug 20 2010
"Kagamin" <spam here.lot> wrote in message news:i4mksr$2fh$1 digitalmars.com...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");
Aug 20 2010