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