FT_ISBIT

FT_ISBIT()
 Test the status of an individual bit

 Syntax

      FT_ISBIT( <cByte>, <nBitPos> ) -> lResult

 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

     .T. if designated bit is set (1), .F. if not set (0), NIL if
      invalid parameters.

 Description

     Tests for status of any selected bit in the byte passed as a parameter.
     Byte must be presented in CHR() form, as a literal constant, or as the
     one-byte character result of an expression.

     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 tests whether bit 3 is set in the byte represented by
     CHR(107):

      lBitflag := FT_ISBIT(CHR(107), 3)
      ? lBitflag                  // result: .T.

      This code tests whether bit 5 is set in the byte represented by ASCII
      65 (letter 'A')

      ? FT_ISBIT('A', 5)          // result: .F.

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

 Source: ISBIT.PRG

 Author: Forest Belt, Computer Diagnostic Services, Inc.

See Also: FT_BITSET() FT_BITCLR()

 

One response to “FT_ISBIT

  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.