I am trying to call an external application in my C++ program , example,
system("C:\Program Files\Internet Explorer\iexplore.exe");
but the application just gets closed. Can any one help me!
Dear All,
Thanks a lot. my problem is resolved.
1. double slashes need to be used. thanks for the suggestion and
2. the command that worked for me was "ShellExecuteEx"
Quoted paths need a doubleslash for backward slashes (e.g. your path would be system("C:\\Program Files\\Internet Explorer\\iexplore.exe");)
Considering iexplore.exe is usually in the system path, this would work too (but is as dangerous as using system() in the first place: system("iexplore.exe");)
This said, you should avoid system().
It opens an entire world of flaws, many antiviruses will mark your program as a virus, and many other bad things will happen.
@mutexe: Personally, I use ShellExecute, since it is able to open arbitrary files too.
Also something to keep in mind is that the WinAPI will normally except a forward slash '/' in place of a backslash '\' for UNC paths and neither C or C++ see those as escape characters.