passing a string with the & character as an argument

Jos van Uden user at domain.invalid
Tue Feb 28 23:21:46 PST 2012


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



More information about the Digitalmars-d-learn mailing list