Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get main return value

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How can I get the main return value, for example

const char* main(int argc, char* argv[])
{
....
return "Hello";
}
 
I don't thing you need the * efter char

const char main(int argc, argv[])
{
...
return "hallo"
}

Hope it help you
 
You wouldn't want to return a char* from main() - it would most likely be an invalid pointer in any case (as the process would have died, freeing up allocated resources). If you want to see the return from main, run it from a batch file that echos its output to screen.
 
The standard says you can only return int. In DOS, the return value is stored in ERRORLEVEL.

If you want to return anything besides an int, you can printf or cout to stdout.

Let me know what do you really want to do.

HTH
Shyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top