title: Using C++ ifstream extraction operator>> to read formatted data from a file
body: <p>As my learning, I am trying to use c++ ifstream and its operator>> to read data from a text file using code below. The text file outdummy.txt has following contents:</p>
  
  <pre><code>just dummy
  Hello ofstream
  555
  </code></pre>
  
  <p>My questions is how to read char data present in the file into a char array or string. How to do this using the ifstream::operator>> in code below.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  int main()
  {
      int a;
      string s;
      char buf[100];
      ifstream in("outdummy.txt",ios_base::in);
  
  
      in.operator&gt;&gt;(a); //How to read integer? How to read the string data.??
  
      cout &lt;&lt; a;
  
      in.close();
      getchar();
      return 0;
  }
  </code></pre>