Thank you for your help!
Since you asked why I'm doing this:
I'm using three different environments: live, testing, and development. Each environment uses a different database. When I run my program, I must pass the port number as a startup parameter to connect to the correct database. By reading the port number, I can determine which environment I'm in and set other variables (such as source and compilation directories) appropriately.
I've followed Cringer's suggestion (parsing the session:startup-parameters), and it's worked great so far.