[comp.lang.pascal] turbo pascal 5.0 SetFAttr help....

lyda@sybil.cs.Buffalo.EDU (kevin lyda) (08/02/90)

this program compiles perfectly and runs with the problem described at the
end of the code.

{$A+,B-,D+,E+,F-,I+,L+,N-,O-,R-,S+,V+}
{$M 16384,0,327680}
program test;
 
uses
  dos;
 
var
  log : text;
  f : file;
  attr : word;
 
begin
  assign(f,'c:\language');
  assign(log,'c:\tmp\log');
  rewrite(log);
  setfattr(f,hidden);
  writeln(log,doserror);           {----> 0                         }
  getfattr(f,attr);                     {no dos error from setfattr }
  writeln(log,attr,' ',doserror);  {----> 18 0                      }
  setfattr(f,directory);                {hidden directory, no dos   }
                                        {error from getfattr        }
  writeln(log,doserror);           {-??-> 5                         }
  getfattr(f,attr);                     {dos error `file access     }
                                        {denied' from setfattr      }
  writeln(log,attr,' ',doserror);  {----> 18 0                      }
  close(log);                           {directory is still hidden..}
end.
 
question: why is file access denied? when i hide an archive file i
can unhide it later, but not directories. is this a bug and more
importantly, is there a way i can hide AND unhide directories?