passing a string with the & character as an argument

jic cabrera at wrc.xerox.com
Wed Feb 29 06:46:36 PST 2012


James Miller Wrote:

> On 29 February 2012 20:21, Jos van Uden <user at domain.invalid> wrote:
> > On 29-2-2012 7:06, James Miller wrote:
> >>
> >> On 29 February 2012 18:51, jic<cabrera at wrc.xerox.com>  wrote:
> >>>
> >>>
> >>> Greetings!
> >>>
> >>> I have this program,
> >>>
> >>> import std.process : system;
> >>> import std.stdio;
> >>> int main(char[][] args)
> >>> {
> >>>  char[] cmd;
> >>>
> >>>  for (int i=1;i<args.length;i++)
> >>>  {
> >>>    cmd ~= args[i] ~ " ";
> >>>  }
> >>>  writefln(cmd);
> >>>  return(1);
> >>> }
> >>>
> >>> if I compile it and run it this way,
> >>>
> >>> test 1! 2@ 3&  4#
> >>>
> >>> the result is
> >
> >
> >>
> >> If you are on Windows, then I don't know why this is happening.
> >
> >
> > On windows the ampersand also has a special meaning. In that case
> > try the carrot ^ to escape
> >
> > test 1! 2@ 3^&  4#
> >
> > Jos
> >
> 
> Today I Learned that windows has insane escaping.
> 
Me too.  I tried escaping it with the wonder-working \, but that didn't work.  This does work.  Weird stuff...  Thanks all.


More information about the Digitalmars-d-learn mailing list