New topic: Advice needed - how to deal with file locking issue
<http://forums.realsoftware.com/viewtopic.php?t=29681> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message MagicMatt Post subject: Advice needed - how to deal with file locking issuePosted: Fri Aug 21, 2009 3:23 pm Joined: Tue Aug 05, 2008 1:20 pm Posts: 284 I have an application which receives data every 2 seconds. That data is written into a text file (CSV format) which I open, write to, and close - I do this so that the file can be accessed by another application - specifically PHP running on Apache on the same machine (it's a Windows XP SP3 machine). An issue arises when the file gets to a reasonably large size. If somebody is downloading the file at the time the next data needs to be written, the file is locked and so I get a NilObject result when attempting to open the file to append text. Obviously one thing I could do is simply not write to the file when it's locked.... but then what do I do with the mounting data? The only option I can think of is to create a new temporary file if the normal file I want is locked, then when it becomes available again I add the temporary file contents onto the end of my original file and carry on as usual. I'm concerned there that I may just move the problem, because if the temp file gets large, I may lose a reading while the two files are being merged - where do I put those readings? Another temp file? So, before I embark upon this task, I wondered if anyone could offer advice on a better way to deal with the problem than my proposed solution. _________________ REALBasic 2008r5.1 Professional Windows XP SP3 Toshiba Tecra A9-11M Laptop Intel Core2 Duo T7700 @ 2.4GHz with 2Gb RAM @ 800MHz plus various other WinTel machines. (and a broken MacBook Pro 3.1 with OS-X 10.5.2 with no networking or sound thanks to a lightening storm) Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
