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????????
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");
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