CToBin Function | |
-- todo --
Converts a binary character representation to a numeric value.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax FUNCTION CToBin(
cExpression,
cFlags
) AS USUAL CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static Usual CToBin(
Usual cExpression = default,
Usual cFlags = default
)
Request Example
View SourceParameters
- 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.
Remarks cFlags | Description |
---|
1 | cExpression is an expression that is 1 byte long. |
2 | cExpression is an expression that is 2 bytes long. |
4 | cExpression is an expression that is 4 bytes long. |
8 | cExpression 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.
|
R | Reverses the binary expression. |
S | Prevents 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")
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