(Time Waster) writes:
> Is this a stupid use of flock:
>
> FILE *fp=fopen(SOME_FILE_CONSTANT,"r+");
> flock(fileno(fp),LOCK_EX);
> something important here, including reads and a write to fp
> flock(fileno(fp),LOCK_UN);
> fclose(fp);
[snip]
This is not a good place to ask. flock() is not a standard C
function; in fact, standard C provides no facility for locking files.
comp.unix.programmer is a better place to ask about this -- but since
flock() isn't defined by the POSIX standard either, they might advise
you to use lockf() instead.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"