[fpc-pascal] Avoiding File conflicts

wkitty42 at windstream.net wkitty42 at windstream.net
Tue Jan 5 15:30:11 CET 2021


On 1/4/21 11:06 AM, Bart via fpc-pascal wrote:
> On Mon, Jan 4, 2021 at 3:19 AM James Richters via fpc-pascal
> <fpc-pascal at lists.freepascal.org> wrote:
> 
>> I suspect that I happen to see the file is there and try to read it before the program that created the file is done writing it.
>> What is the proper way to detect the file is in use so I don't bother trying to open it until it's done being written?
> 
> Simple approach?
> Use filemode = fmOpenRead and use a try..except block to open the file?
> Opening will fail if the file is locked by another process (triggering
> the exception).

provided the other program opens the file for creation properly (eg: 
blahDenyAll), right?


-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list where it belongs!*


More information about the fpc-pascal mailing list