Hi I'm working with C++ on Linux platform, i have to get the value of a environment variable(user defined) and use it further. Following is the code I'm using,
const char *show_line = getenv ("MY_SHOW_LINES");
bool myFlag = (strcmp(show_line, "1") == 0) ? false : true;
Above code executes properly when i set the value of environment variable(MY_SHOW_LINES) equal to 1 but when i unset the value of it(i.e. unset MY_SHOW_LINES). Above code gives memory fault. Any suggestion on above UN-expected behavior?? Thanks in advance