RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.FileSetReadOnly Function

Sets the file permissions to read-only.

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

SysUtils

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) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!