Reply to Re: How to get to know if file is currently being written by another app?

Your name:

Reply:


Posted by Jerry Stuckle on 12/09/07 00:00

alexandis@gmail.com wrote:
> I now had chance to check this.
> At least the following DIDN'T WORK - even being-written files were
> shown:
>
> while (false !== ($filename = readdir($handle))) {
> if ($filename != "." && $filename != "..") {
> $fp = fopen($resultsourcefile_dir.$filename, "a
> +");
> if (flock($fp, LOCK_EX)) {
> flock($fp, LOCK_UN);
> //display the file
> }
> }
> }
>
> p.s. I had to use "a+", not "a", because I also read from the file
> inside the loop. But if it doesn't matter, right? Maybe it's just a
> matter of OS... :(
>

This will work if the other application also uses flock(). But if it
doesn't, there isn't any real way you can tell.

The bottom line is - if the other application doesn't "play nice",
there's not much your application can do.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация