Page 1 of 1

CHMOD question

Posted: Sat Dec 03, 2005 6:42 pm
by alex.barylski
I have a files permission bits as 666 (decimal)

Read/Write for Owner, Group and Other are all set...

I need to programatically detemrine if Read/Write Owner is set...

Can this be done using a bitwise operation??? If so...can you show me how???

I have tried a simple (666 & 400) == 400

But this doesn't work...

Basically I need a way programatically to take a permission bits and determine which permissions they apply too...

Anyone??? :)

Thanks

Posted: Sun Dec 04, 2005 1:01 am
by AGISB
http://www.php.net/manual/en/function.fileperms.php

or use umask to set them directly