flush out buffer into file
<pre><code>int main()
{
  string line;
  char buff[10];
  for(int i=0; i&lt;10;i++)
  {
     cin.get(buff[i]);
     cout.put(buff[i]);
     if(i==10)
     {
       ofstream file;
       file.open("TEXT",ios::out);
       for (i=0 ; i&lt;10 ;i++)
         file &lt;&lt; buff[i] &lt;&lt; endl;
       file.close();
     }
  }
}
</code></pre>

<p>this code is not flushing the data from array to file and even file is also not created...</p>
