Click or drag to resize

Functions.CToBin Method

-- todo --
Converts a binary character representation to a numeric value.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.18
Request Example View Source


cExpression (Optional)
Type: Usual
Specifies the binary character representation to convert.
cFlags (Optional)
Type: Usual
If the binary character representation specified with cExpression was generated using an 8 byte data type (currency or double, for example), include cFlags to control the type of value returned by CToBin( ).

Return Value

Type: Usual
Numeric. CToBin( ) returns a numeric value from a binary character expression.
1cExpression is an expression that is 1 byte long.
2cExpression is an expression that is 2 bytes long.
4cExpression is an expression that is 4 bytes long.
8cExpression is an expression that is 8 bytes long.
B cExpression is a double data type, and must be 8 bytes long.
CToBin( ) returns a double data type value. This is the default for an expression that is 8 bytes long.
N cExpression is a numeric data type, and must be 4 or 8 bytes long.
CToBin( ) returns a numeric type value.
Y cExpression is a currency data type, and must be 8 bytes long.
CToBin( ) returns a currency type value.
RReverses the binary expression.
SPrevents the sign bit of number from being toggled (BitXOR).
The cFlags parameter is a character expression. The 'R' and 'S' settings are additive while the others are mutually exclusive. Character settings can be passed in either upper or lower case (e.g., 'R' or 'r'). Specifying a value of '1', '2' or '4' is not required, but is available as a convenience to provide feedback for the length of cExpression.
The following examples show various uses of the cFlags parameter.
1? CToBin("A")// same as CToBin("A","1")
2? CToBin(BinToc($12.34,"8"),"Y")
3? CToBin(BinToc(12.34,"8"),"B")
4? CToBin(BinToc(PI(),"BR"),"NRS")
You can use CToBin( ) to convert a binary character representation created with BinToc( ) to its integer value. CToBin( ) can also be used when working with Win32 API routines where you might need to convert to or from a Win32 struct member. The 'R' and 'S' settings allow you to use CToBin ( ) to work more efficiently with these scenarios.
See Also