c++ process start problem with path
I'm using process::start(PATH);
to open up the process. The problem is, sometimes 开发者_C百科it finds the file and sometimes it doesn't.
For example, this works:
process::start("C:\text.exe");
But this doesn't work:
process::start("C:\New Folder\text.exe");
Any idea what the difference is?
You have to escape the \
characters.
In a C string \t
is the TAB character. Use:
process::start("C:\\New Folder\\text.exe");
The library might think that c:\New is the program you are running, and Folder\text.exe is an argument you are passing to it.
You might need to quote it, so you're calling this:
"C:\New Folder\text.exe"
Which as a C++ string would look like this:
process::start("\"C:\\New Folder\\text.exe\"");
精彩评论