Main() returns to the OS. You will have to use OS specific scripting to read the return value. Another option is to call your program from another program using spawn(). This function returns the exit status of the called program to the calling program. I believe spawn() or a variant is available on both Windows and UNIX platforms.
If you are using NT, check the value of ERRORLEVEL. The following example assumes you are calling a program called MYCPROG.EXE and shows the value returned by MAIN (assuming of course it is 0);