|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need to lock read a text file, then delete...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? Sorry for my bad english. Thanks in advance, Alessandro Noro Alessandro wrote:
> Hi everybody, Rename the file before you start reading it. That way, any writer will> 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? (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 Thanks Larry for your quick reply.
I thought about the solution You suggest me, but unfortunately I cannot do so, because I could delete the Input file only if I could find other files (depending on what I find inside the Input file). Otherwhise I have to wait, and leave the Input file "free" for more writings. I also thought about reading the Input file, then remove all the lines inside, leaving it empty. But I don't know how to do this... Thanks again. Alessandro Noro Copy the file to another location.
Delete the file Create the new file for new additions Do the processing of the file in your code at the new location. Delete file at new location so you can do the same next time. -- Show quoteHide quoteGet a powerful web, database, application, and email hosting with KJM Solutions http://www.kjmsolutions.com "Alessandro" <no***@seait.it> wrote in message news:1147189610.283351.255110@u72g2000cwu.googlegroups.com... > Thanks Larry for your quick reply. > > I thought about the solution You suggest me, but unfortunately I cannot > do so, because I could delete the Input file only if I could find other > files (depending on what I find inside the Input file). Otherwhise I > have to wait, and leave the Input file "free" for more writings. > I also thought about reading the Input file, then remove all the lines > inside, leaving it empty. But I don't know how to do this... > > Thanks again. > Alessandro Noro > Allessandro
This is an old Jewish witz Bram asks to the Rabi: "Rabi can God make everything he wants? The Rabi answers: "Yes of course Bram" Bram asks: "Rabi can God make a stone which he cannot lift himself? Your question sounds the same for me. (I never forget this witz because there is so much true in it). Cor Show quoteHide quote "Alessandro" <no***@seait.it> schreef in bericht news:1147189610.283351.255110@u72g2000cwu.googlegroups.com... > Thanks Larry for your quick reply. > > I thought about the solution You suggest me, but unfortunately I cannot > do so, because I could delete the Input file only if I could find other > files (depending on what I find inside the Input file). Otherwhise I > have to wait, and leave the Input file "free" for more writings. > I also thought about reading the Input file, then remove all the lines > inside, leaving it empty. But I don't know how to do this... > > Thanks again. > Alessandro Noro >
How to disable the numericupdown event firing?
Mailmerge Automation Problems VB Form: Controlbox = False byte array size for read or write of filestream Dataset or SQL? wich is faster? Basic Database Questions Using VSS and VS.NET 2003 problem with code for dataset with mutilple tables Check if Service is running? How to interrupt a running program |
|||||||||||||||||||||||