title: Reading from text file using ifstream
body: <p>I am trying to read from text file using ifstream object with extraction operator (>>) , and when I perform the following code , it is not reading at all ! </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;iomanip&gt;
  
  void outputLine( int account, const char *const name , double balance )
        {
           cout &lt;&lt; left &lt;&lt; setw( 10 ) &lt;&lt; account &lt;&lt; setw( 13 ) &lt;&lt; name
              &lt;&lt; setw( 7 ) &lt;&lt; setprecision( 2 ) &lt;&lt; right &lt;&lt; balance &lt;&lt; endl;
        } // end function outputLine
  
  
  int main()
  {
      ofstream outfile("client.txt",ios::out);
      if (!outfile)
      {
          cout &lt;&lt; "the file is not opened .. " &lt;&lt; endl ;
          exit(1);
      }
      int account;
      char name[30];
      double balance;
      while (cin &gt;&gt; account &gt;&gt; name &gt;&gt; balance)
      {
          outfile &lt;&lt; account &lt;&lt; ends &lt;&lt; name &lt;&lt; ends &lt;&lt; balance &lt;&lt; endl ;
          cout &lt;&lt; "? " ;
      }
      outfile.close();
  
      ifstream inFile;
      inFile.open( "client.txt",ios::in);
  
       if ( !inFile )
       {
        cerr &lt;&lt; "File could not be opened" &lt;&lt; endl;
         exit( 1 );
       } // end if
  
       cout &lt;&lt; left &lt;&lt; setw( 10 ) &lt;&lt; "Account" &lt;&lt; setw( 13 )
         &lt;&lt; "Name" &lt;&lt; "Balance" &lt;&lt; endl &lt;&lt; fixed &lt;&lt; showpoint;
  
      while (inFile &gt;&gt; account &gt;&gt; name &gt;&gt; balance )
      {
          outputLine( account, name, balance );
      }
  
      return 0 ;
  }
  </code></pre>
  
  <p>Is there any error in this code ? </p>