I try to call getenv in my C code, this can return correct env string in terminal, while it returns NULL in GDB/DDD.
void main() {
char * a = getenv("ANCHOR_STEM");
if (strlen(a)>0)
printf("%s\n", a);
}
The GDB/DDD is started from the same terminal. Even I "show environment", this env exists.
Anyone any idea?
OS/Tools version info: RHEL Linux hostname1 2.6.32-754.3.5.el6.x86_64 #1 SMP Thu Aug 9 11:56:22 EDT 2018 x86_64 GNU/Linux GNU gdb (GDB) 7.12 gcc (GCC) 6.3.0
mainis wrong. It must returnint. And paremeter list is either(void)or(int argc, char *argv[]). Empty parameter list is obsolete. - Gerhardh