How can we do this. How can we run .exe from a c++ program.
Suppose I have a file located in C: name "abc.exe".
Now how will I execute this "abc.exe" file from a c++ program????????
This is a discussion on Run .exe from a c++ program within the C++ Programming forums, part of the General Programming Boards category; How can we do this. How can we run .exe from a c++ program. Suppose I have a file located ...
How can we do this. How can we run .exe from a c++ program.
Suppose I have a file located in C: name "abc.exe".
Now how will I execute this "abc.exe" file from a c++ program????????
Assuming Windows, this fires up notepad:
Code:HANDLE open_notepad() { STARTUPINFO si = {sizeof( STARTUPINFO)}; PROCESS_INFORMATION pi; CreateProcess( "c:\\windows\\notepad.exe", 0, 0, 0, 0, 0, 0, 0, &si, &pi); return pi.hProcess; }
Or perheps something like this if you do managed:
Code:System::Diagnostics::Process::Start("C:\\abc.exe");
Managed is not C++. C++/CLI is a managed language, and usually they mean "native" C++.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
You can also use the standard system() function, or you can use popen(), or one of the spawn() functions...
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010