Click or drag to resize

Bin2Real4 Function

Convert a string containing a 32-bit floating point number to a Real4 value.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.10
Syntax
 FUNCTION Bin2Real4(
	cFloat AS STRING
) AS REAL4
View Source

Parameters

cFloat
Type: String
A 32-bit floating point number represented as a string — least significant byte first.  Only the first 4 bytes are used by the function; all others are ignored.

Return Value

Type: Single
Remarks
Bin2Real4() is a conversion function that converts the first 4 bytes of a string to a 32-bit floating point number.  Typical applications include reading foreign file types in their native format then saving, reading, decrypting, and transmitting numeric data in their compressed binary form instead of in strings.  Its inverse is Real42Bin().
Examples
This example shows that Real42Bin() is the inverse of Bin2Real4():
X#
cString := Real42Bin(1245633.25)
? cString                                                        // 4-byte string
? Bin2Real4(cString)                        // 1245633.25
See Also