Issue with opening PDF file from FilePro
Kenneth Brody
kenbrody at spamcop.net
Fri May 29 20:45:17 PDT 2009
Fairlight wrote:
[...]
> 1) Check for file's existance with exists(). If it's there, open it. If
> you can open it read/write, then:
>
> 2) Check the file's size with FILESIZE() on the opened handle.
>
> 3) Institute a loop that sleeps for one second. Close the file, re-open
> it, and check FILESIZE() each iteration. If you go a second with no new
> data, you're -probably- safe to exit the loop and proceed onwards.
There's no need to close/re-open the file. If the file size changes, then
FILESIZE() will see it. (Unless the O/S lies to filePro, which would mean
that bigger things would fail, like adding records to a file with no free
records.)
> NOTE: I do -not- like this solution, as it IS still subject to a race
> condition.
I'm not sure if I would call it a "race condition". But, you are depending
on the file size changing between checks, which is in no way guaranteed.
> And if you don't close/re-open the file between checks, be
> it on your own head; I'm 50/50 as to whether or not FILESIZE() will pick
> up on changes to the file's size once it's opened--depends how it's done
> internally. This could be OS-dependant, or it may be absolute behaviour,
> and only Ken can answer that.
As I said, filePro will see the file size change unless the O/S lies to
filePro, which would cause other problems elsewhere.
> That said, it -should- give reasonably consistent results if you check the
> actual size over time.
--
Kenneth Brody
More information about the Filepro-list
mailing list