[fpc-pascal] Does the system unit allow file locking/sharing?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Jan 17 10:02:02 CET 2017


On 16/01/17 22:30, Lars wrote:
> On Mon, January 16, 2017 2:34 pm, I previously wrote:
>> The oldschool way of opening files using the system unit (no sysutils)
>> has the filemode variable..
>>
>> system.FileMode := fmOpenRead; ...
>> Assign(...
>> Rewrite(...
>>
>>
>>
>> Can this be used with file locking/sharing OR-ed options like:
>> fmShareCompat fmShareDenyNone fmShareDenyRead fmShareDenyWrite
>> fmShareExclusive
>>
>> Or does file locking/sharing require using sysutils unit with fileopen:
>> http://www.freepascal.org/docs-html/rtl/sysutils/fileopen.html
>>
>
> To answer my own question... Looking into the fpc rtl sources I found that
> DoFileLocking is inside sysutils, so likely system unit (old school
> handling of files) cannot be used with locking at this stage.

This is likely to be platform-specific once you start looking at locking 
as distinct from open mode.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list