473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

catch the return value of int



Hi

Is there any way to catch the return value of the main program?

Regards
Srinath.D

Aug 13 '07 #1
3 1738
srinath duraisamy wrote:
Is there any way to catch the return value of the main program?
That's OS-dependent. Your debugger should be able to tell you, or
the OS can have a mechanism similar to DOS' "errorlevel", or you
could execute the process (using whatever means your OS provides)
and that should have the ability to capture the return value of
the process when it exits (that's how the debugger does it, BTW).
You need to ask in the newsgroup for your OS (or just RTFM).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 13 '07 #2
srinath duraisamy <sr******************@gmail.comwrote:
>

Hi

Is there any way to catch the return value of the main program?
Yes, many operating systems can catch that value and test it in a
scripting language. Shell scripting languages in Unix can do it. the
batch language in WinXP can do it.

You might want to tell us more about what you're trying to accomplish,
then we might be able to point you in the right direction.

--
Tim Slattery
Sl********@bls.gov
http://members.cox.net/slatteryt
Aug 13 '07 #3
On Aug 13, 6:10 pm, Tim Slattery <Slatter...@bls.govwrote:
srinath duraisamy <srinathduraisamy....@gmail.comwrote:
Hi
Is there any way to catch the return value of the main program?
main is called by OS so it returns valur to OS. if you want to know
what it's returning, you can cout before returning.

Aug 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: George | last post by:
Hi All, I thought this would not compile because no return value is specified. But it does compile and run (aix and xlc v7.0.) Could someone kindly please point me to where in the spec this...
10
by: Bungle | last post by:
Hi I am trying to do something really simple. Create a method within a class which will connect to the database, pull back a result and return it out the method. Not hard. All my database...
13
by: Benny | last post by:
Hi, I have something like this: try { // some code } catch // note - i am catching everything now {
6
by: Martin Ortiz | last post by:
Which is best approach? Should Try + Catch be used to only deal with "catastrophic" events (like divide by zero, non-existant file, etc...etc...) Or should Try + Catch be used IN PLACE of...
13
by: Woody Splawn | last post by:
I have a try catch statement in a fucntion that is supposed to return a true or a false My code looks like this: Try mySqlConnection.Open() Dim Da1 As New SqlDataAdapter("Select JnlType,...
20
by: Woody Splawn | last post by:
In a message yesterday titled Try Catch Question I got numerous responses. Thank you to all. After all the smoke clears I guess the question is where to place the Return True statement in the...
4
by: Noah Roberts | last post by:
The following code does VERY strange things in the debugger. Is there anything wrong with the following code, UB or anything else? #include <iostream> #include <exception> #include <stdexcept>...
3
by: Doug | last post by:
Hi i have a method that returns a value public bool readxml (string xmlFilename, out string value) but I would like to catch an exception if it occurs in the method . How do i catch the...
28
by: gnuist006 | last post by:
I have some code like this: (if (test) (exit) (do something)) or (if (test)
3
by: aemado | last post by:
I am really new to the try/catch/throw concept, and can't figure out what is wrong with my code. Any suggestions? #include <iostream> using namespace std; string msgZero = "Zero...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.