[fpc-pascal] How to tell if file is locked, i.e. FileOpen in sysutils

Lars noreply at z505.com
Mon Jan 16 07:44:50 CET 2017


The fileopen function returns -1 on error, but there is no way to tell if
the error is because of a lock, or another issue opening the file?

I'm interested in finding out specifically if a file is locked, as it
would be useful for example in a wiki to say to the user "File is locked
by another person contributing, please go back and refresh the page to see
updates and resolve conflicts"

If the fileopen function just returns -1 there is no way to tell if it is
a lock issue, or another file issue unrelated to locks?

http://www.freepascal.org/docs-html/rtl/sysutils/fileopen.html

Thanks!

Also, really appreciate whoever implemented file locking mechanism cross
platform as it was something I needed (would have even set up a bounty for
such).



More information about the fpc-pascal mailing list