Help - FAttrib

Help - FAttrib

Postby sanilpmc » Mon Sep 29, 2008 9:45 am

Dear All,

how can i set multiple attrib for a file using FAttrib() method. For eg. Hidden and system together in a single Fattrib command

Sanil
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am

Postby anserkk » Mon Sep 29, 2008 9:49 am

Sanil

Please try this

Code: Select all  Expand view
FAttrib(FileName,02+04)  // 02 -> Hidden and 04 -> System


I belive that this will make Hidden and System attrib together in a single shot

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby sanilpmc » Mon Sep 29, 2008 10:14 am

Thank you,

Its working, Now i can set multiple attrib for a folder or a file using FAttrib(). But Sir I have one more question

How can I remove the attrib from a folder or a file using FAttrib().
Or is there any other function for it

Sanil
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am

Postby anserkk » Mon Sep 29, 2008 11:08 am

Sanil,

FAttrib(cFileName, ) ie without any parameter resets the attrib to empty

I don't know hot to reset a particular attrib alone ie to change READ ONLY attribute alone if the file already has a HIDDEN and READ ONLY attribute is set.

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby sanilpmc » Mon Sep 29, 2008 11:28 am

anserkk wrote:
FAttrib(cFileName, ) ie without any parameter resets the attrib to empty

I don't know hot to reset a particular attrib alone ie to change READ ONLY attribute alone if the file already has a HIDDEN and READ ONLY attribute is set.


Thank you

Sir, when I apply this method it removing all attrib from the file or folder. But I need to remove a particular attrib not all. Which means if a file have READ ONLY, HIDDEN and SYSTEM, in this case only needs to remove System and Hidden attrib.

Regards
Sanil
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am

Postby Antonio Linares » Thu Oct 02, 2008 4:44 pm

Sanil,

You need to use nXor() to exclude the attributes that you don't want.

Or use nAnd() to select the attributes that you just want.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby sanilpmc » Fri Oct 03, 2008 5:37 am

Antonio Linares wrote:You need to use nXor() to exclude the attributes that you don't want.

Or use nAnd() to select the attributes that you just want.


Sir,

Can i get a sample programe regarding changing attrib for a file using nXor(),nAnd(). Because i try this in my programe it doesn't work for me.

Regards
Sanil
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am

Postby Antonio Linares » Fri Oct 03, 2008 7:11 am

Code: Select all  Expand view
function Main()

   local nAttrib := FAttrib( "test.prg" )

   MsgInfo( nAttrib ) // 32 is shown

   FAttrib( "test.prg", nOr( nAttrib, 4 ) ) // We want to set "system style"
   
   MsgInfo( nAttrib := FAttrib( "test.prg" ) ) // 36 is shown

   FAttrib( "test.prg", nXor( nAttrib, 4 ) ) // We want to remove "system style"

   MsgInfo( FAttrib( "test.prg" ) ) // 32 is shown again

return nil


http://en.wikipedia.org/wiki/Exclusive_or
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests