Click or drag to resize

Logic2Bin Function

Convert a logical value to a string containing an 8-bit logical value.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION Logic2Bin(
	lValue AS LOGIC
) AS STRING
View Source

Parameters

lValue
Type: Boolean
The logical value to convert.

Return Value

Type: String
Remarks
Logic2Bin() is a conversion function that converts a logical data type into a 1-byte string.  Typical applications include saving data in their native format, data decryption, and transmitting logical data in their binary form.  Its inverse is Bin2Logic().
Examples
This example creates a new binary file, then writes a logical value in a binary form:
X#
LOCAL ptrHandle AS PTR
ptrHandle := FCreate("MyFile", FC_NORMAL)
FWrite3(ptrHandle, Logic2Bin(TRUE), 1)
FClose(ptrHandle)
See Also