[Issue 9344] A program takes a console comand as an argument.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 17 23:28:17 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9344



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2013-01-17 23:28:16 PST ---
(In reply to comment #0)
> import std.stdio;
> 
> int main(char[][] p_Args) 
> { 
>  foreach(char[] l_Arg; p_Args)
>  {
>    writefln("Argument '%s'", l_Arg);
>  }
>  return 0;
> }
> 
> /+
> Input and output example:
> 
> $ ./a.out MY NAME HERE
> Argument './a.out'
> Argument 'MY'
> Argument 'NAME'
> Argument 'HERE'
> 
> On Ubuntu 12.10 compiled with gdc,the version that can be found on its
> repositories.
> +/

Sorry, what is the problem? As far as I see, the input/output example works as
expected.

The `main` function always receive the command string by p_Args[0]. It is same
as C/C++ behavior.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list