Click or drag to resize

Bin2Logic Function

X#
Convert a string containing an 8-bit logical into a logical value.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION Bin2Logic(
	pszLogical AS STRING
) AS LOGIC
Request Example View Source

Parameters

pszLogical
Type: String
An 8-bit logical represented as a string.

Return Value

Type: Logic
Remarks
Bin2Logic() is a conversion function that converts the first byte of a string to a logical. Typical applications include saving data in their native format, data decryption, and transmitting logical data in their binary form.
Its inverse is Logic2Bin().
Examples
This example opens a file using file functions, reads the first byte as a binary logical, then converts it into a logical value:
X#
1ptrHandle := FOpen("sales.txt", FO_READ)
2cByte := Space(1)
3FRead(ptrHandle, @cByte, 1)
4? Bin2Logic(cByte)))            // Returns either TRUE or FALSE
5FClose(ptrHandle)
See Also