title: setting variables with argv
body: <p>Here is a minimal working example describing my current situation. The file main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  void print_from_external_file();
  
  using namespace std;
  
  int main( int argc, char* argv[])
  {
      print_from_external_file();
  
      return 0;
  }
  </code></pre>
  
  <p>The file containing print_from_external_file()</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  namespace
  {
      int a;
  }
  
  void print_from_external_file()
  {
      cout &lt;&lt; a &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Here is my <strong>goal</strong>: I wish to run this program by command line like "test.exe 2". The integer 2 I want to be loaded into the variable <em>a</em> in the external file. Is there a way to accomplish this without having to call print_from_external_file() with argv[1]? In other words, can "a" be given the value "2" automatically?</p>