I need to export several variables such that they look like the following in the command line
export ROS_HOSTNAME=xxx
How do I use setenv()
Here the signature for the setenv function
#include
int setenv(const char *envname, const char *envval, int overwrite);
Link : http://pubs.opengroup.org/onlinepubs/009695399/functions/setenv.html
In your case you call it like this:
setenv("ROS_HOSTNAME", "xxx", true);
the last boolean argument indicates if you want to overwrite the value of the environment variables if it already exists.