Xbasic

BLOB.DUMP Function

Syntax

Data as C = dump(C format)

Arguments

format

An string that formats the output. The string may have the following flags separated by spaces. All other characters in the Format_String are printed as is, which is useful for introducing separators into the output.

Element
Description
A character representation of a number

The number of bytes to offset from the beginning of the file before beginning the dump.

"H"

The dump should be in hexadecimal format.

"A"

The dump should contain an ASCII representation.

"L"

Double word values.

"S"

Single word values.

Description

Dump the contexts of a blob to HEX (optional format hex per line, for hex/ascii etc, numbering).

Discussion

The .DUMP() method dumps the contents of a blob using the specification provided by the Format_String. For example, the following Xbasic code opens a temporary Alpha Anywhere query file and dumps out its contents.

Example

f = file.open("$$021001.Mpx",FILE_RO_SHARED)
b = f.readb(100000)
f.close()
? b.dump("O H A" + CRLF())
= 0000 00 08 00 00 00 00 00 00 00 00 00 01 0A 00 E0 00 ................
0010 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

The leading number in the format string specify the width of the dumped data in bytes. The default is 16 bytes per line. For example, the following would print 32 characters per line.

b.dump("32O A" + CRLF())

See Also