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