Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-01

How to tell if file is locked, i.e. FileOpen in sysutils

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lars

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).