Re: Need to lock read a text file, then delete...




Alessandro wrote:
Hi everybody,
I tried to find some information about my subject with google, but I
didn't find anything.

I need to read a text file, process the entire content, then kill. In
the meantime I have to be sure that no one could write on it. So I
opened with read write lock, but when i closed it, before deleting,
someone wrote something, and I lost the information because immediately
after I killed it.

Have you any suggestion?

Rename the file before you start reading it. That way, any writer will
(presumably) find the file missing, and create a new blank one to write
to.

I guess we are talking about parsing a log file or something like that?

Sorry for my bad english.

Better than my Italian.

--
Larry Lard
Replies to group please

.



Relevant Pages