If your program is meant to be called from a Shell with some self defined parameters, then it would be useful to set return code if it couldn't act as exspected, e.g. if it is called within a Shell script / Batch file...
One could define a new env variable and after program execution check the value of this env variable. But it would be more clean to use an OS' default mechanism.
I tried to set my OS' default result variable:
MorphOS:
Code: Select all
SetEnv("RC",30)
End
When a compiled Hollywood program exits, it always overrides the return code with value 0.
Imagine, your program gets an argument -textfile and shall do some operations on this file, this file might not be available -> thus porgram should quit with an error code
Code: Select all
If myaction_result="success"
End ; or End(0)
Else
End(30)
EndIf