|If you embed your C executable in a script , e.g. a batch, you can check the return code to keep track of program execution; see the following|
Cprog /T HostName
if not errorlevel 1 echo Connection established
where Cprog.exe returns 0 if no failure occurred while running, otherwise a return code greater or equal to 1 is posted.
The return code can be inspected in case of running the program inside another one, see the C system() function.
Main's return code is the legacy of your just ended run leaving you a message about what happened.