RAD Studio VCL Reference
SysUtils.FileSetReadOnly Function

Sets the file permissions to read-only.

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

FileSetReadOnly attempts to set the read-only status of the specified file. 

FileName is the name of the file to alter. 

ReadOnly indicates the status to assign to the file. 

FileSetReadOnly returns true if the operation was successful and false if an error occurred.

Note: On Windows, the ReadOnly parameter is assigned to the file's read-only flag.
Note: On Linux, the inverse of the ReadOnly parameter is assigned to the file's user write, group write, and other write permission bits. The active user must have permission to perform these operations.
FileSetReadOnly is designed to support cross-platform code. To manipulate permissions more specifically than FileSetReadOnly allows, use platform-specific functions. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!