passing a string with the & character as an argument

jic cabrera at wrc.xerox.com
Tue Feb 28 21:51:17 PST 2012


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

1! 2@ 3

So, if I pass a string with an &, the argument array stops right
before the &.  How can I pass a & in a string?  I tried escaping it,
but it does not work either.

thanks for the help.

jic


More information about the Digitalmars-d-learn mailing list