title: fstream to display all text in txt
body: <p>I want to display all the text that is in the fille to the output, 
  I use  by using the code below, the code I got up and results posts are just a little out</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
    char str[10];
  
    //Creates an instance of ofstream, and opens example.txt
    ofstream a_file ( "example.txt" );
    // Outputs to example.txt through a_file
    a_file&lt;&lt;"This text will now be inside of example.txt";
    // Close the file stream explicitly
    a_file.close();
    //Opens for reading the file
    ifstream b_file ( "example.txt" );
    //Reads one string from the file
    b_file&gt;&gt; str;
    //Should output 'this'
    cout&lt;&lt; str &lt;&lt;"\n";
    cin.get();    // wait for a keypress
    // b_file is closed implicitly here
  }
  </code></pre>
  
  <p>The above code simply displays the words "This" does not come out all into output.yang I want is all text in the file appear in the console ..</p>