title: Can an ifstream variable be a global variable?
body: <pre><code>// stream from file.
  ifstream file;
  
  int main (int argc, char * argv[]) {
  
  // get argument passed from command line
  // This is file name
  if (argc != 2 ) {
      cout &lt;&lt; "use:  ./executable &lt;filename&gt;";
  
  }else {
      //cout &lt;&lt; "You are using filename: " &lt;&lt; argv[1];
  
      // start the file stream
      file (argv[1]);
  }
  </code></pre>
  
  <p>Is there any reason why <code>file(argv[1])</code> would be giving an error? Can I have a ifstream as a global variable?</p>