[fpc-pascal]question about FileGetAttr

Jonas Maebe jonas at zeus.rug.ac.be
Thu Jul 11 11:57:34 CEST 2002


On Wed, 10 Jul 2002, milimeter wrote:

>   under /usr/local/, I have a file of information:
>   -rw-r--r-- root root aaa.dat
>   so the file belongs to root, and can be read by any user.
>   Then I try to test the file use another user: milimeter as following
>     writeln('File Attr: ',FileGetAttr('aaa.dat'));
>   then I get 32, it means it is writable. But actually, it's readonly for user milimeter. Why this result? A bug?

What makes you think that this means that the file is writable? I just
looked at the source, and filegetattr() does not return the permissions of
a file. It returns whether a file has the "archive" flag set (always set
to true under Linux, since there is no such flag there), whether it's a
directory, whether it's hidden, whether it's read-only and whether it's a
system file. The appropriate bits you can test are called faArchive,
faDirectory, faHidden, faReadOnly and faSysFile.


Jonas





More information about the fpc-pascal mailing list