?
Solved

Setting file attribute

Posted on 1999-07-25
4
Medium Priority
?
180 Views
Last Modified: 2010-04-04
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
0
Comment
Question by:Hencah
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Epsylon earned 0 total points
ID: 1391129
Example:

SetFileAttributes('File.txt', FILE_ATTRIBUTE_READONLY or FILE_ATTRIBUTE_HIDDEN);

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1391130
Veru quick Epsylon, but wrong I think... :-)

Cheers,

Raymond.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1391131
To clear the read-only attribute:

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

0
 
LVL 10

Expert Comment

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

..-=ViKtOr=-..
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…
Suggested Courses

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question