I have this console application for Windows that takes a file, performs some calculations and then writes the output to the specified file. The input is specified in the format "app.exe -input fullfilename". I need to call this application from my C ++ program, but I have a problem with spaces in the file path. When I call the application directly from cmd.exe, typing (without specifying the output file for clarity)
"c:\first path\app.exe" -input "c:\second path\input.file"
everything works as expected. But, when I try to use the cstdlib function std :: system (), i.e.
std::system(" \"c:\\first path\\app.exe\" -input \"c:\\second path\\input.file\" ");
the console prints that c: \ first is not a valid command. This is probably a common mistake and has a simple solution, but I could not find it. Thanks for any help.
source
share