tags:

views:

38

answers:

2

I am trying to execute a file with parameters using the "system()" function in C++ on Windows, and it works as long as there are no whitespaces in the filename. For parameters, putting double quotes around the string works, but when I try the same with the executable itself, I get the following error:

"the filename,directory name, or volume label syntax is incorrect"

Does anyone know how to handle this correctly?

A: 

It should work, look for the problem elsewhere.

Perhaps something in your flow is removing the whitespace or the double quotes from the string.

Igor Oks
+1  A: 

Use a string like this:

cmd /S /C "your entire command line string"

See: http://stackoverflow.com/questions/355988/how-do-i-deal-with-quote-characters-when-using-cmd-exe

bshields
Seams to work, thanks!
VolkA