Description
grp_w can be AND'd (see and operator (bitwise)) with the filemode retrieved by the built-in procedure getfilemode to determine if any user belonging to the same group as the owner of a file or directory has permission to write to the file or directory.
Example
For example the simple program below asks for a filename and then displays the group permissions for the file.
program GroupPermissions(input, output);
var
s : filename;
mode : integer;
isdir : boolean;
begin
write('Enter filename:');
readln(s);
s := fexpand(s);
getfilemode(s, mode);
isdir := (mode and dir_bit) <> 0;
write('Group permissions :');
if (mode and grp_r) <> 0 then
write(' Read');
if (mode and grp_w) <> 0 then
write(' Write');
if (mode and grp_x) <> 0 then
if isdir then
write(' Search')
else
write(' Execute');
writeln;
end.
Portability
Operating Systems: All
Standard Pascal: No