Link to home
Start Free TrialLog in
Avatar of Hencah
Hencah

asked on

Setting file attribute

Hi,

I have a problem to set file attribute.  I want to clear read-only attribute from a file which has read-only attribute.
HOw to do this? Thank you very much for your help.

Regards cah
ASKER CERTIFIED SOLUTION
Avatar of Epsylon
Epsylon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rwilson032697
rwilson032697

Veru quick Epsylon, but wrong I think... :-)

Cheers,

Raymond.
To clear the read-only attribute:

var attr: DWORD;
begin
  attr := GetFileAttributes('file.txt');
  SetFileAttributes('File.txt', attr and not FILE_ATTRIBUTE_READONLY);
end;

I don't think the first piece of code would work, but the second one sure will ;-)

..-=ViKtOr=-..