delorie.com/archives/browse.cgi | search |
From: | Nate Eldredge <neldredge AT hmc DOT edu> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Detecting File in Use? |
Date: | 24 Apr 2001 16:31:25 -0700 |
Organization: | InterWorld Communications |
Lines: | 21 |
Sender: | nate AT mercury DOT st DOT hmc DOT edu |
Message-ID: | <83snixzxgy.fsf@mercury.st.hmc.edu> |
References: | <q142et86haqtgeileohcgemoni9bctv9mf AT 4ax DOT com> <3ae12439_2 AT rapidnet DOT net> |
NNTP-Posting-Host: | mercury.st.hmc.edu |
Mime-Version: | 1.0 |
X-Trace: | nntp1.interworld.net 988155086 55830 134.173.57.219 (24 Apr 2001 23:31:26 GMT) |
X-Complaints-To: | usenet AT news DOT interworld DOT net |
NNTP-Posting-Date: | Tue, 24 Apr 2001 23:31:26 +0000 (UTC) |
User-Agent: | Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
richard AT stardate DOT bc DOT ca (Richard Sanders) writes: > >How does one know if a file is ALREADY in USE by > >some application BEFORE any actual attempt to open > >or access that file? > > Check out the access(); function. That has nothing to do with it. The correct answer is: you can't reliably find out. lsof would tell you whether the file was open, but that could change before you get around to actually doing something with it. If you need to enforce some kind of sharing between applications, you'll need to use file locking in both of them. -- Nate Eldredge neldredge AT hmc DOT edu
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |