Code Comments
Programming Forum and web based access to our favorite programming groups.On 31 Mar, 06:33, Aditya <adityagupta...@gmail.com> wrote: > But then how can the behaviour of the application be modified so that > the fwrite() or fs() calls do give me the indication of the file > been deleted. The process still has the open file, and any writes/s
s will (probably) succeed. The fact that some other process has removed the directory entry that your process used to originally access the file is irrelevant. When you called fopen(), you used one of the names for the file (maybe the only one), and once you have the file you don't need the name anymore. When someone else executed rm to destroy that name....you don't really care. If that name happened to be the only name for the file (ie, there are no other hard links) there is a good chance that when your process is done, any data that it has written to the file will be lost because no other process will be able to open the file. But this is hardly different than someone deleting the file immediately after your process finished.
Post Follow-up to this messageOn Apr 1, 1:17=A0am, William Pursell <bill.purs...@gmail.com> wrote: > On 31 Mar, 06:33, Aditya <adityagupta...@gmail.com> wrote: > > > The process still has the open file, and any writes/ss will > (probably) succeed. =A0The fact that some other process has > removed the directory entry that your process used to > originally access the file is irrelevant. =A0When you called > fopen(), you used one of the names for the file (maybe > the only one), and once you have the file you don't > need the name anymore. =A0When someone else executed > rm to destroy that name....you don't really care. =A0If that > name happened to be the only name for the file (ie, > there are no other hard links) =A0there is a good chance that > when your process is done, any data that it has written > to the file will be lost because no other process will be > able to open the file. =A0But this is hardly different than > someone deleting the file immediately after your > process finished. thanks a lot for the highly informative discussion and answers to you all. I got the point and now I will be ensuring the existence of the file, instead of relying on the failure of the file handling standard C calls .
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.