qgetenv returns NULL
I need to get the value of a environment variable in linux(UBUNTU). For
this purpose I am using "qgetenv" function with the environment variable
name. I can confirm that value of environment variable is set because when
I do echo $VARIABLE_NAME, it is perfectly printing the value of the
variable. This snippet of the code I am using:
QByteArray root = qgetenv("PAPARAZZI_HOME");
if (root.data()==NULL) {
cerr << "PAPARAZZI_HOME is not defined" << endl;
exit(0);
}
string pprzRoot = string(root.data());
and echo $PAPARAZZI_HOME prints following string:
"/home/manish/paprazzi-git/paparazzi/"
No comments:
Post a Comment