title: What factors can lead to Win32 error 665 (file system limitation)?
body: <p>I maintain an application that collects data from a datalogger and appends that data to the end of a binary file.  The nature of this system is that the file can grow large (> 4 gigabytes) small steps at a time.  On of the users of my application has seen cases on his NTFS partition where the attempts to append data fail.  The error is being reported as a result of a call to fflush().  When this happens, the return value for GetLastError() is 665 (ERROR_FILE_SYSTEM_LIMITATION). MSDN gives the following <a href="http://msdn.microsoft.com/en-us/library/ms681388%28v=vs.85%29.aspx" rel="nofollow">description</a> for this error</p>
  
  <blockquote>
    <p>The requested operation could not be completed due to a file system limitation </p>
  </blockquote>
  
  <p>A search for this error code on google gives results related to SQL server with VERY large files (tens of gigabytes) but, at present, our file is much smaller.  This user has not been able to get the file to grow beyond 10 gigabytes.  We can temporarily correct the situation when we do some operation (like copying the file) that forces some sort of rewrite in the file system.  Unfortunately, I am not sure what is going on to put us in this condition in the first place.  What specific conditions in an NTFS file system can lead to this particular error being reported on a call to fflush()?</p>