title: Issues reading input from a .txt file
body: <p>I'm working on a project that requires that input must be taken from a file and then processed. We were given a skeleton of the code for opening a file and checking to make sure it is open, but I'm having issues opening the file.</p>
  
  <p><strong>My Code</strong></p>
  
  <pre><code>int main()
  
  {
      readFile();
  }
  
  void readFile()
  {
      ifstream fin;
      string fileName;
      int x;
  
      cout &lt;&lt; "Enter the file you wish to read from: ";
      cin &gt;&gt; fileName;
  
      fin.open(fileName.c_str(), ios::in);
  
      if(!fin.is_open())
      {
          cerr &lt;&lt; "Unable to open file " &lt;&lt; fileName &lt;&lt; endl;
          exit(10);
      }
  }
  </code></pre>
  
  <p>My console:
  <a href="http://i.stack.imgur.com/2derI.jpg" rel="nofollow">http://i.stack.imgur.com/2derI.jpg</a></p>
  
  <p>We were basically given all of this code so I have absolutely no idea why this isn't working out. This is just a part of my much larger project but I can't even attempt that part yet until I get this working. Any help would be much appreciated.</p>