This is test example:
(1). simple program doing endless loop:
#include <iostream>
using namespace std;
int main() {
int counter = 0;
while (1) cout << ++counter << ": endless loop..." <<endl;
}
(2). another program that launches above example through system()
command:
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
system("endless_loop.exe");
cout << "back to main program" << endl;
}
When doing Ctrl+Break
on this program text back to main program
doesn't show.
How to restrict this key combination to inside process and return execution pointer back to main app ?
Another thing is that I don't always have control over source code of inside program, so I can't change things there.