Hi,
I saw this C program on Unix with
unlink("tmp.log");
unlink("time.log");
at the end of the file.
What's the purpose of doing this?
Thanks a lot!
Hi,
I saw this C program on Unix with
unlink("tmp.log");
unlink("time.log");
at the end of the file.
What's the purpose of doing this?
Thanks a lot!
try man unlink
unlink removes links specified by a path. When all links are removed the file no longer exists. However, if a file is open by a process, the filesystem keeps the file around until the process goes away. It's a safe way to create a temp file then be guaranteed the file will be removed no matter what happens to the process. In this case another spawned process probably has those file open.