title: need for allocating memory of ofstream pointer
body: <p>In this program:</p>
  
  <pre><code>#include&lt;fstream&gt;
  #include&lt;iostream&gt;
  
  int main()
  {
     std::ofstream *fb;
     (*fb).open("file.txt",std::ios::out);
  
     std::cout.rdbuf((*fb).rdbuf());
  
     std::cout&lt;&lt;"Hello World to ALL";
  
     return 0;
  }
  </code></pre>
  
  <p>On running it gives <strong>segmentation fault</strong> - so on changing <code>*fb</code> to <code>fb</code> helps as no space was allocated </p>
  
  <p>But what I don't understand is why does an <code>ofstream</code> object requires a space to be allocated if the memory which it needs to handled (<code>file.txt</code>) is already there? Shouldn't it be like the way file I/O is handled in <strong>C</strong> language where a <code>FILE</code> pointer is used to open and then the operations are performed without allocating any memory?</p>
  
  <p>Plus what will the <strong>allocated memory</strong> using <code>ofstream</code> pointer functionally (theoraticaly) signify?</p>