Hi Guys,
I am writting a DOS app in C++ using Allegro.
It is a GUI that will be able to run an external app when a key is pressed.
How can I run an external app (testapp.exe) and once I finished with it, have my
main app regain itself as it was before I ran testapp.exe.
The problem I have is when I close the testapp I am left with a blank screen - and not my GUI.
I know how to do this in QBASIC and VB6 - but not C++ 
I envoke the testapp with: system("testapp.exe")
// Setup
allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
// ---------- clipped -----------
while( !key[KEY_ESC]){
if (key[KEY_1]){
if (confArr[16] == "1"){
int sound = play_sample(snd_sample, 128, 0, 1000, 0);
void destroy_sample(SAMPLE *spl);
system("testapp.exe");//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< here
}
}
}
Suggestions?
Cheers,
DOS doesn't share resources very well (read: at all), so if the other app wants to use graphics or something, you have to shut it down, call the app, then restart it.
// Shutdown Allegro allegro_exit(); system("testapp.exe"); // Re-init Allegro (don't forget error checking) allegro_init(); install_timer(); set_gfx_mode(...); install_sound(...); install_keyboard(); install_mouse();
Ahh, Ok I'll give it a go
Is there a reason why you have to use DOS? If there isn't, or if the reason goes by the name of 'djgpp', then consider using mingw.
DOS doesn't share resources very well (read: at all), so if the other app wants to use graphics or something, you have to shut it down, call the app, then restart it.
File access is prone to errors as well. The best way to do it under windows is to start a new thread, run the program, and shut down the thread. I found some source code for doing this as it's all winapi calls but I cleverly didn't bookmark it...
Edit; I don't think this is what I found, but it's close and it has some links.
Thanks for the replies guys. It MUST be DOS in my case 
I have implimented Kitty Cats suggestion and that seems robust.
(I am using DJGPPP + Allegro)
Cheers,