FT_BITCLR

FT_BITCLR()
 Clear (reset) selected bit in a byte

 Syntax

      FT_BITCLR( <cByte>, <nBitPos> ) -> cByte

 Arguments

     <cByte> is a character from CHR(0) to CHR(255).

     <nBitPos> is a number from 0 to 7 conforming to standard
     right-to-left bit numbering convention and representing the
     position of the bit within the byte.

 Returns

     Returns new byte, with designated bit cleared (reset).
     If parameters are faulty, returns NIL.

 Description

     In effect, ANDs argument byte with a byte that has all bits set except
     the target bit.  If bit is already clear (0), it remains clear.
     Note: Calls FT_ISBIT() which is also in this Library.

     This function is presented to illustrate that bit-wise operations
     are possible with Clipper code.  For greater speed, write .C or
     .ASM versions and use the Clipper Extend system.

 Examples

     This code would clear bit 4 in a byte represented by CHR(115):

       cNewByte := FT_BITCLR( CHR(115), 4 )
       ? ASC( cNewbyte )         // result: 99
       ? cNewByte                // result: 'c'

     This code would clear bit 5 in the byte represented by letter 'A':

       FT_BITCLR( 'A', 5 )       // result: 'A', since
                                 // bit 5 already clear

     For a demonstration of Clipper bit manipulations, compile and
     link the program BITTEST.PRG in the Nanforum Toolkit source code.

 Source: BITCLR.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BITSET() FT_ISBIT()

One response to “FT_BITCLR

  1. Pingback: FT String | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.