DW2Bin Function | |
Convert a double word to a string containing a 32-bit unsigned integer.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION DW2Bin(
dwValue AS DWORD
) AS STRING
public static string DW2Bin(
uint dwValue
)
Request Example
View SourceParameters
- dwValue
- Type: DWord
The value to convert. Decimal digits are truncated.
Return Value
Type:
String
A 4-byte string containing a 32-bit unsigned integer.
Remarks
DW2Bin() is a conversion function that converts a double word to a 4-byte string. 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 Bin2DW().
Examples
This example uses DW2Bin() to record our current memory settings to a debugging file:
1FUNCTION RecordMemory() AS LOGIC
2 LOCAL nh
3 LOCAL lSuccess := FALSE AS LOGIC
4 nh := FOpen2("debug.doc", FO_READWRITE)
5
6 IF nh != F_ERROR
7 FWrite3(nh, DW2Bin(Memory(1)), 4)
8 FWrite3(nh, DW2Bin(Memory(2)), 4)
9 FWrite3(nh, DW2Bin(Memory(3)), 4)
10 FClose(nh)
11 lSuccess := TRUE
12 ELSE
13 ? "An error occurred when opening debug.doc"
14 FError()
15 ENDIF
16 RETURN lSuccess
See Also