FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help - FAttrib
Posts: 36
Joined: Tue Jun 17, 2008 07:09 AM
Help - FAttrib
Posted: Mon Sep 29, 2008 09: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

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help - FAttrib
Posted: Mon Sep 29, 2008 09:49 AM
Sanil

Please try this

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
Posts: 36
Joined: Tue Jun 17, 2008 07:09 AM
Help - FAttrib
Posted: 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

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help - FAttrib
Posted: 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

Posts: 36
Joined: Tue Jun 17, 2008 07:09 AM
Help - FAttrib
Posted: 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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Help - FAttrib
Posted: Thu Oct 02, 2008 04: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
Posts: 36
Joined: Tue Jun 17, 2008 07:09 AM
Help - FAttrib
Posted: Fri Oct 03, 2008 05: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Help - FAttrib
Posted: Fri Oct 03, 2008 07:11 AM
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

Continue the discussion