Ask Your Question

Revision history [back]

This question is not really related to ROS, but I'm going to answer as if you are using your C++ file as part of a ROS node. In that case you can use roslaunch to start your node, and in your launch file you can read the value of an environment variable as a substitution argument. That value can then be passed to your node as a parameter.