Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Can a file be deleted even if it is in use.
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/ss 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.


Report this thread to moderator Post Follow-up to this message
Old Post
William Pursell
04-01-08 02:55 AM


Re: Can a file be deleted even if it is in use.
On 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 .

Report this thread to moderator Post Follow-up to this message
Old Post
Aditya
04-01-08 09:47 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): « 1 [2]
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:07 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.