Article View: borland.public.cppbuilder.nativeapi
Article #15523Re: How change file properties.
From: Vladimir Afanasyev
Date: Thu, 03 Jul 2003 08:10
Date: Thu, 03 Jul 2003 08:10
31 lines
1707 bytes
1707 bytes
Hi Salvador,
"Salvador Huertas" <shuertasw@ghuertasauto.com> wrote:
>Hi,
>how can I change the file property "Editable" from Only-Read to Writable, by
>code.
>
Follow must help:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
DWORD Attrib=GetFileAttributes("c:\\myfile.txt");
if(Attrib == 0xFFFFFFFF)
{
ShowMessage("GetFileAttributes error");
Application->Terminate();
return;
}
Attrib=Attrib & (~FILE_ATTRIBUTE_READONLY);
BOOL res=SetFileAttributes("c:\\myfile.txt",Attrib);
if(!res)
{
ShowMessage("SetFileAttributes error");
Application->Terminate();
return;
}
}
Vladimir.
Technical Details
Message-ID:
<3f03e4f1$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f03df7b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,6914b723656bb038 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-03 01:14:12 PST From: "Vladimir Afanasyev" <avv@systema.kiev.ua> Sender: "Vladimir Afanasyev" <avv@systema.kiev.ua> Reply-To: "Vladimir Afanasyev" <avv@systema.kiev.ua> Subject: Re: How change file properties. Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 62.244.14.114 62.244.14.114 X-Forwarded-For: 192.168.0.147 References: <3f03df7b@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3f03e4f1$1@newsgroups.borland.com> Date: 3 Jul 2003 01:10:25 -0700 X-Trace: newsgroups.borland.com 1057219825 207.105.83.65 (3 Jul 2003 01:10:25 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail