[fpc-pascal] Avoiding File conflicts
Bart
bartjunk64 at gmail.com
Mon Jan 4 17:06:26 CET 2021
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).
--
Bart
More information about the fpc-pascal
mailing list