Windows command line and execv

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Aug 23 12:26:02 PDT 2010


On 8/23/10 5:14 CDT, Steven Schveighoffer wrote:
> On Fri, 20 Aug 2010 02:48:51 -0400, Nick Sabalausky <a at a.a> wrote:
>
>> "Nick Sabalausky" <a at a.a> wrote in message
>> news:i4kv18$14qh$1 at digitalmars.com...
>>> Is execv known to
>>> trick the windows command-line into giving control back to the user?
>>>
>>
>> Ok that seems to be the case. See the attached screenshot. But it
>> works fine
>> on Linux though (assuming you add the proper "./", of course).
>
> std.process.system simply calls the standard C system function. So
> whatever Windows does with that is the same as when you call the D version.
>
>>
>> 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
>
> phobos I/O is built on top of the C I/O model, which auto-flushes after
> newlines (I think only on consoles, but I'm not sure).

Yes, to the best of my knowledge auto-flushing upon \n happens only if 
isatty() is true.

Andrei


More information about the Digitalmars-d mailing list