• Advertisement
Sign in to follow this  

Return from main

This topic is 3650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just had a nice idea for a quick program but it depends on running other programs. Is there any way I can tell what the return value from the main function of another program in C++?

Share this post


Link to post
Share on other sites
Advertisement
The return value from the function you use to spawn an instance of an application - whether one of the exec functions, fork under Unix or CreateProcess under Windows - will either be the exit value from the application or an identifier you can supply to a query function. Given that most of these functions do not wait for the spawned application/process to end, you'll need some way of knowing when it terminates.

Share this post


Link to post
Share on other sites
Quote:
Original post by KodeNerd
I just had a nice idea for a quick program but it depends on running other programs. Is there any way I can tell what the return value from the main function of another program in C++?


If "running other programs" is primarily what it will do, then you almost certainly don't want to use C++ - or any "serious" programming language - for the task. Instead, write a batch (Windows) / shell (Linux) script.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement