What happens to an fstream when file size limit exceeds?
<p>Recently I have a program went strange in the field. After some checking, it seems due to the file size limit was reached and the fstream in the program became 'not good' and 'bad'. Fortunately, on the platform, the fstream was not able to write once this happened; and the program always reserve empty space before modifying the file. Therefore the file is not corrupted.</p>

<p>Is the behavior the same on all platforms? I read <a href="http://en.cppreference.com/w/cpp/io/basic_ostream/write" rel="nofollow">cppreference.com</a>, it says</p>

<blockquote>
  <p>std::basic_ostream::write</p>
  
  <p>Writes count characters to the stream. If good() != true, setstate(failbit) is called and the function returns.</p>
</blockquote>

<p>By reading the text, I am not sure fstream guarantees the file is untouched if write is failed by the file limit. Any idea?</p>
