System.SysUtils.FileSetReadOnly

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function FileSetReadOnly(const FileName: string; ReadOnly: Boolean): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall FileSetReadOnly(const System::UnicodeString FileName, bool ReadOnly);

Properties

Type Visibility Source Unit Parent
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

Description

Sets the file permissions to read-only.

The FileSetReadOnly method attempts to set the read-only status given by the ReadOnly parameter of the specified file given by the FileName parameter.

The FileSetReadOnly method returns True if the operation was successful, and False if an error occurred.

Note: If the FileName parameter is a symbolic link, the method will be performed on the target file.

Note: On MAC OS, FileSetReadOnly attempts to set or remove all three (user, group, and other) write permissions on the file.

FileSetReadOnly is designed to support multi-device code.

To manipulate permissions more specifically than FileSetReadOnly allows, use platform-specific functions.

See Also