oth_r

Description

oth_r can be AND'd (see and operator (bitwise)) with the filemode retrieved by the built-in procedure getfilemode to determine whether users not belonging to the same group as the owner of a file or directory has permission to read from the file or directory.

Example

For example the simple program below asks for a filename and then displays the file permissions for users who not belong to the same group as the owner of the file.

   program OtherUsersPermissions(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('Other permissions :');
      if (mode and oth_r) <> 0 then
         write(' Read');
      if (mode and oth_w) <> 0 then
         write(' Write');
      if (mode and oth_x) <> 0 then
         if isdir then
            write(' Search')
         else
            write(' Execute');
      writeln;
   end.

Portability

Operating Systems: All
Standard Pascal: No