[fpc-pascal] How to get the permission f a file ?

Karoly Balogh (Charlie/SGR) charlie at scenergy.dfmk.hu
Wed Jun 17 16:54:49 CEST 2015


Hi,

On Wed, 17 Jun 2015, fredvs wrote:

> But how to check if a file has executable permission (and if not, change it
> with fpchmod(thefile S_IRWXU);) ?

>From the top of my head: fpStat(), and in the returned stat structure,
look for the mode field (or st_mode?). There are more useful bits in
there. There is also fpFStat() and fpLStat() (for symlinks).

There are also several S_* constants in BaseUnix unit for easier testing
of various permission combinations.

Charlie



More information about the fpc-pascal mailing list