Click or drag to resize

Bin2Logic Function

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

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

Parameters

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

Return Value

Type: Boolean
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#
ptrHandle := FOpen("sales.txt", FO_READ)
cByte := Space(1)
FRead(ptrHandle, @cByte, 1)
? Bin2Logic(cByte)))                        // Returns either TRUE or FALSE
FClose(ptrHandle)
See Also