I am developing an application that will run with a GUI when no commandline args are passed, but can also run invisibly if started from the commandline and passed necessary arguments. I have been asked to include a /version argument that will return a version number. For simplicity this version number can be stored in a variable. Without doing something like writing the version number out to a file, what is the best way for me to return this info to the caller? My app will almost always be started from a script, so the script will have to read the version number and make decisons based on the version.
I am developing an application that will run with a GUI when no commandline
Share
Google gave me this, should do what you want? referenceIf you want to return a value to the caller, you can do change your main() method signature to return an integer instead.
Note that you can only return an int. If you want something like “1.0.2” you can either come up with a scheme for the numbering (like padding with zeroes etc) or encode it in some way, but that’s up to you.