Skip to content

Write_Hex

See Also: File I/O Commands, Write, WriteLn, Read

Purpose

To write binary data as two-byte hexadecimal numbers.

Syntax

write_hex
[
    channel
    channelNum
]
value
[
    ...
    value
]

Argument Explanation

  • channelNum: A value of any class or type in the range 0 to 9, representing the output channel to use. This only needs to be given when output is going to multiple places.
  • value: The data to be written.

What It Does

This command works similarly to the write command. Use write_hex to output hexadecimal digits, and write to print text normally.

write_hex writes hexadecimal values for the characters in value to the file or device named in the last direct_output command. write_hex can be used in conjunction with read_hex to convert data between binary and text formats.

Example

direct_output "File.txt"
write_hex "ABCD EFGH"

This example will output the following text to FILE.TXT:

414243442045464748

The hex code for "A" (in ASCII) is 41, "B" is 42, "C" is 43, etc.

Notes

  • The output file or device must be opened with the direct_output or append_output command prior to using Write_Hex.