system vs. execvp ?

Jonathan M Davis jmdavisProg at gmx.com
Sat Sep 22 16:15:20 PDT 2012


On Sunday, September 23, 2012 01:12:34 Andrej Mitrovic wrote:
> On 9/23/12, Peter Sommerfeld <noreply at rubrica.at> wrote:
> > What is wrong here?
> 
>   string[] cmd;
>   cmd ~= "dmd";
>   cmd ~= "src/xyz.d";
>   int i = execvp("dmd",cmd);
> 
> 1st arg should always be the app name, even though apps typically
> ignore/skip the first arg.

Are you sure about that? That seems pretty messed up if that's the case. Yes, 
the first element in the argument list that main gets is the name of the 
program, but it's pretty messed up if any of the exec* functions require that 
you give the program name as the first argument rather than it being 
appropriately added by that program before its main is called. I'd be very 
surprised if you were correct about this.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list