title: how many bytes actually written by ostream::write?
body: <p>suppose I send a big buffer to ostream::write, but only the beginning part of it is actually successfully written, and the rest is not written</p>
  
  <pre><code>int main()
  {
     std::vector&lt;char&gt; buf(64 * 1000 * 1000, 'a'); // 64 mbytes of data
     std::ofstream file("out.txt");
     file.write(&amp;buf[0], buf.size()); // try to write 64 mbytes
     if(file.bad()) {
       // but suppose only 10 megabyte were available on disk
       // how many were actually written to file???
     }
     return 0;
  }
  </code></pre>
  
  <p>what ostream function can tell me how many bytes were actually written?</p>