CToBit()
Converts a character string into a bit pattern
Syntax
CToBit( <ccCharacterstring>, <cBitPattern> ) -> <nWord>
Arguments
<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.
Returns
CToBit() returns a number in the range of 0 to 65535 that corresponds to the created bit pattern.
Description
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.
Note
. Characters in <cCharacterstring> that are not found in <cBitpattern> are ignored.
Examples
. 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
Platforms
All
Files
Source is numconv.prg, library is libct.
Seealso
BitToC()
Pingback: Harbour Conversion Functions | Viva Clipper !
Pingback: Harbour All Functions – C | Viva Clipper !