Resetting the read only attribute

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Resetting the read only attribute

Arí Ricardo Ody
Is there a way to turn a 'read only' file to 'non-read only'???

Reading the manual I can't conclude how to do this... (I'm talking
about windows XP files)

Greetings from Sao Paulo - Brazil

Ricardo

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Resetting the read only attribute

Ewald Horn
Hi.

You could use FileSetAttr('filename', faArchive)
method to set the attributes to archive and remove the
read only flag.

Remember to include SYSUTILS if you have not already
done so.

Regards
Ewald



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Resetting the read only attribute

Arí Ricardo Ody
Thank you Ewald!

IMHO the manual is not clear in this matter(:-\).

Regards

Ricardo




At 15:54 1/8/2006, you wrote:

>Hi.
>
>You could use FileSetAttr('filename', faArchive)
>method to set the attributes to archive and remove the
>read only flag.
>
>Remember to include SYSUTILS if you have not already
>done so.
>
>Regards
>Ewald
>
>
>
>_______________________________________________
>fpc-pascal maillist  -  [hidden email]
>http://lists.freepascal.org/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Resetting the read only attribute

Tomas Hajny
In reply to this post by Arí Ricardo Ody
On 1 Aug 06, at 14:57, Arí Ricardo Ody wrote:

> Is there a way to turn a 'read only' file to 'non-read only'???
>
> Reading the manual I can't conclude how to do this... (I'm talking
> about windows XP files)

I guess that it's mostly because attribute
setting isn't portable across platforms
(SysUtils.FileSetAttr always returns -1 on all
Unix platforms and Dos.SetFAttr is simply ignored
there). DOS-like (which includes Windows and
OS/2) attributes are partly emulated for
functions reading attributes, but their changes
cannot be emulated meaningfully (well, it might
be possible the other way round, i.e. emulating
the more complex/complete solution for writing
and the simpler one for reading, but the
usefulness would be probably questionable.

Tomas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal