title: Can the WriteFile() function just stop working?
body: <p>I have a windows program written in C++. It periodically writes information to a text file using <code>WriteFile()</code> WinAPI function.</p>
  
  <p>The program opens the file when it starts and leaves the file opened until it exits. The program opens the file using this code:</p>
  
  <pre><code>CreateFileW(path, GENERIC_WRITE, FILE_SHARE_READ, &amp;sa,
      OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
  </code></pre>
  
  <p>The following problem has occured recently: after running about 10 days the program stopped writing information to the file. But when the program was restarted, it resumed writing to the file.</p>
  
  <p>Suppose the program has no bugs and WriteFile continues to be invoked to write data: can the <code>WriteFile</code> function just start failing after some period of normal working? What can cause this? 
  (Except disk space problems. The file is rather small and disk has enough space).</p>
  
  <p>(unfortunately the program does not check the <code>WriteFile</code>'s return value).</p>