<cCharacterstring> Designates a character sequence. When this sequence occurs in the second character string, each corresponding bit is set to 1.
<cBitpattern> Designates a sequence, with a maximum of 16 characters, from which the bit position is assigned.
CToBit() returns a number in the range of 0 to 65535 that corresponds to the created bit pattern.
The CToBit() function delivers a bit pattern that corresponds to a string of individual characters. When used in conjunction with its sister function BitToC(), it facilitates work with such bit-coded information as file attributes.
. Characters in <cCharacterstring> that are not found in <cBitpattern> are ignored.
. The second bit in the resulting value is set, since the letter
"H" appears in the next-to-last position in "ADVSHR":
? CToBit("H", "ADVSHR") // Result: 00000010
. Two characters also in ADVSHR, appear at the first and final
positions in this 6-character string:
? CToBit("RA", "ADVSHR") // Result: 00100001
. <cBitpattern> ignores previously unavailable characters:
? CToBit("XRYA", "ADVSHR") // Result: 00100001
Converts position-dependent bits into characters
SyntaxBITTOC(<nInteger>,<cBitpattern>,[<lMode>]) --> cCharacterstringArguments<nInteger> Designates a number in the range of 0 to 65535, which
corresponds to a bit pattern.
<cBitpattern> Designates a character string with a maximum of 16
characters. Each character corresponds to a bit in <nInteger>, where
the last character corresponds to the lowest-value bit.
<lMode> When this optional parameter is designated as .T., 0 bits
change to blanks. The default is no change.
The returned string contains the corresponding characters passed by the
The BITTOC() function changes the bits of a number into a sequence of
corresponding characters. This facilitates work with such bit-coded
information as file attributes. Depending on the <lMode> logical
parameter (the l in lMode symbolizes logical), 0 bits either displays no
character (.F.) or a blank (.T.).
Note. If <lMode> is designated as .T., the string length that
results always corresponds to <cBitpattern>.
Examples. Change file attributes:
. The number 2 corresponds to a binary "00000010":
? BITTOC(2, "ADVSHR") // "H" as the next to
// last character
. The number 5 corresponds to a binary "00000101":
? BITTOC(5, "ADVSHR") // "SR"
. The number 5, with the 0 bit displayed as a blank:
? BITTOC(5, "ADVSHR", .T.) // " S R"
IntroductionBITTOC() Converts position-dependent bits into characters
CELSIUS() Converts a Fahrenheit temperature value into Celsius
CLEARBIT() Clears one or more bits within a number to zero
CTOBIT() Converts a character string into a bit pattern
CTOF() Converts a special 8-byte string into a floating point number
CTON() Converts a numeric string into a different base
EXPONENT() Determines the exponent of a floating point number (base 2)
FAHRENHEIT() Converts a temperature value from Celsius into Fahrenheit
FTOC() Converts a floating point number into a special 8-byte string
INFINITY() Creates the largest number possible (21023)
INTNEG() Converts an unsigned integer into a signed integer
INTPOS() Converts a signed integer into an unsigned integer
ISBIT() Tests the bits in a number
LTON() Converts a logical value into a numeric value
MANTISSA() Determines the mantissa of a floating point number (base2)
NTOC() Converts numbers in a digit string into a different number base
NUMAND() Performs a 16-bit "AND" of a list of numbers
NUMCOUNT() Uses the internal CA-Clipper Tools counter
NUMHIGH() Returns the higher value byte in a 16-bit number
NUMLOW() Returns the lower value byte in a 16-bit number
NUMMIRR() Mirrors 8-bit or 16-bit values
NUMNOT() Performs a 16-bit "NOT" of a number
NUMOR() Performs a 16-bit "OR" of a list of numbers
NUMROL() Performs a 16-bit left rotation of a number
NUMXOR() Performs a 16-bit "XOR" of two numbers
RAND() Generates random numbers
RANDOM() Generates random numbers
SETBIT() Sets one or more bits in a number