0

in a C++/CLI program I'm using

System::Diagnostics::Process::Start("D:\\users\\Z\\project1\\Sent_0.93\\plotCon\\tester\\bin\\Debug\\tester.exe","20 D:\users\Z\project1\Bright20");

to call the tester.exe, which is another project written in C# (but I think it doesn't matter here) then something strange happens now. If I debug the C# program with command line arguments given in project setting, it's working as expected. If I call this C# program from Start menu->run, it's also working fine. but with the given line above, the C# program is started, but behaves quite wierd. So the question is why and how to change the C++ code to make its calling have exactly the same effect as I call from "Start->run"

Thank you

Matt
  • 741
  • 1
  • 6
  • 17
  • tried also the more complete way like : http://stackoverflow.com/questions/486087/how-to-call-an-external-program-with-parameters – Matt Jun 29 '11 at 13:43

1 Answers1

2

The problem is your string for the arguments parameter -- "20 D:\users\Z\project1\Bright20" has embedded escape characters, you need to use double-backslash as you correctly did for the fileName parameter:

System::Diagnostics::Process::Start(
    "D:\\users\\Z\\project1\\Sent_0.93\\plotCon\\tester\\bin\\Debug\\tester.exe",
    "20 D:\\users\\Z\\project1\\Bright20"
);  //    ^^     ^^ ^^        ^^
ildjarn
  • 62,044
  • 9
  • 127
  • 211
  • yes, exactly. Actually I found out this stupid mistake several minutes after posting... but I can't answer my own question since i have too little reputation points Thanks all the same – Matt Jun 29 '11 at 14:24