I set environment variable this way:
export MY_DIR="$HOME/projects"
Then I want to read that variable in my program:
char *name = getenv("MY_DIR");
but I get a null value, Edit 1: when I run the program using Qt Creator.
When I compile:
g++ myprogram.cpp -o myprogram
and run:
./myprogram
the program form a terminal I get correct variable.