Click or drag to resize

F2Bin Function

Convert a float to a string containing an 80-bit floating point number.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION F2Bin(
	fValue AS FLOAT
) AS STRING
View Source

Parameters

fValue
Type: Float
The value to convert.

Return Value

Type: String
A string representing a floating point number.
Remarks
F2Bin() is a conversion function that converts a string to a floating point number.  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 Bin2F().
Examples
This example saves the return value from the Seconds() function into a debugging binary file:
X#
FUNCTION StoreData() AS LOGIC
        LOCAL nh
        LOCAL lSuccess := FALSE AS LOGIC
        nh := FOpen2("debug.bin", FO_READWRITE)
        // Assumes that file debug.doc already exists
        IF nh != F_ERROR
                FWrite(nh, F2Bin(Seconds()))
                FClose(nh)
                lSuccess := TRUE
        ELSE
                ? DOSErrString(FError())
        ENDIF
        RETURN lSuccess
See Also