title: C++: how can I write a program to read integers from a file?
body: <p>When I use the code recommended in the book, I get an error. I am using NetBeans 6.8 for Mac.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  int main()
  {
  
    ifstream inputFile;
  
    int number;
  
    inputFile.open("MacintoshHD/Users/moshekwiat/Desktop/random.txt");
  
    inFile &gt;&gt; number;
  
    cout&lt;&lt;endl &lt;&lt;number&lt;&lt;endl;
  
    inputFile.close();
  
    return (0);
  }
  </code></pre>
  
  <p>Here is the error:</p>
  
  <pre><code>main.cpp:20: error: 'inFile' was not declared in this scope
  </code></pre>
  
  <p>What needs to be done??
  Thank You</p>