Converts a character string into a bit pattern
CToBit( <ccCharacterstring>, <cBitPattern> ) -> <nWord>
<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
Source is numconv.prg, library is libct.