title: ofstream - detect if file has been deleted between open and close
body: <p>I'm wriiting a logger on linux.<br>
  the logger open a file on init.<br>
  and write to that file descriptor as the program run.<br>
  if the log file will be deleted after the file descriptor was created,<br>
  no exception/error  will be detected .<br>
  i have tried:</p>
  
  <pre><code>out.fail()
  !out.is_open()
  </code></pre>
  
  <p>i have google this and find this post .<br>
  <a href="http://www.daniweb.com/forums/thread23244.html" rel="nofollow noreferrer">http://www.daniweb.com/forums/thread23244.html</a></p>
  
  <p>so i understand now that even if the file was deleted by using rm. it is still exist, it was simply unlinked.<br> 
  what is the best way to handele this?<br>
  1. this is a log application so performance is an issue , i don't want to use stat() on every write<br>
  2. i don't care if some of the line in the log files will be missing at the start <br>
  3. the user is allowed to delete the log file, to start fresh .the logger should reopen the file.  </p>