I am using ubuntu 14.04. I added the following code at the top of main() in a program, but I don't get anything printed when I run it.
char const* masteruri = getenv("ROS_MASTER_URI");
if (masteruri!=NULL){
printf ("The current masteruri is: %s",masteruri);
}
char const* rosdis = getenv("ROS_DISTRO");
if (rosdis!=NULL){
printf ("\n The current rosdis is: %s",rosdis);
}
but the same code in another program gives the expected result
The current masteruri is: http://localhost:11311
The current rosdis is: indigo
I have included stdlib.h and I exported the variables in etc/profile.d