L2Bin Function | |
Convert a long integer to a string containing a 32-bit signed integer.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax FUNCTION L2Bin(
liValue AS LONG
) AS STRING
public static string L2Bin(
int liValue
)
Request Example
View SourceParameters
- liValue
- Type: Long
The value to convert. Decimal digits are truncated.
Return Value
Type:
StringRemarks
L2Bin() is a conversion function that converts a long integer into a 4-byte string. Typical applications include reading foreign file types in their native format and then saving, reading, decrypting, and transmitting numeric data in their compressed binary form instead of in strings.
Its inverse is Bin2L().
Examples
This example creates a new binary file, then writes a series of numbers to the files using L2Bin() to convert the numeric value to 32-bit binary forO:
1LOCAL nNumber, ptrHandle
2ptrHandle := FCreate("MyFile", FC_NORMAL)
3FOR nNumber := 1 UPTO 100
4 FWrite3(ptrHandle, L2BIN(nNumber), 4)
5NEXT
6FClose(ptrHandle)
See Also