usr_r can be AND'd (see and operator (bitwise)) with the filemode retrieved by the built-in procedure getfilemode to determine whether the owner of a file or directory/folder has permission to read from the file or directory/folder.
For example the simple program below asks for a filename and then displays the file permissions for the owner of the file.
program OwnerPermissions(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;
if isdir then
writeln(s, ' is a directory')
else
writeln(s, ' is not a directory');
write('Owner permissions :');
if (mode and usr_r) <> 0 then
write(' Read');
if (mode and usr_w) <> 0 then
write(' Write');
if (mode and usr_x) <> 0 then
if isdir then
write(' Search')
else
write(' Execute');
writeln;
end.
Operating Systems: All
Standard Pascal: No