Click or drag to resize

F2Bin Function

X#
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.19
Syntax
 FUNCTION F2Bin(
	fValue AS FLOAT
) AS STRING
Request Example 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#
 1FUNCTION StoreData() AS LOGIC
 2    LOCAL nh
 3    LOCAL lSuccess := FALSE AS LOGIC
 4    nh := FOpen2("debug.bin", FO_READWRITE)
 5    // Assumes that file debug.doc already exists
 6    IF nh != F_ERROR
 7        FWrite(nh, F2Bin(Seconds()))
 8        FClose(nh)
 9        lSuccess := TRUE
10    ELSE
11        ? DOSErrString(FError())
12    ENDIF
13    RETURN lSuccess
See Also