XBinder  Version 2.9.x
Functions
Hex Dump Functions

Function for printing binary data in hexadecimal text format and for doing binary to hexadecimal text conversion. More...

Functions

EXTERNRT int rtxByteToHexChar (OSOCTET byte, char *buf, OSSIZE bufsize)
 This function converts a byte value into its hex string equivalent. More...
 
EXTERNRT int rtxByteToHexCharWithPrefix (OSOCTET byte, char *buf, OSSIZE bufsize, const char *prefix)
 This function converts a byte value into its hex string equivalent. More...
 
EXTERNRT int rtxHexDumpToNamedFile (const char *filename, const OSOCTET *data, OSSIZE numocts)
 This function outputs a hexadecimal dump of the current buffer contents to the file with the given name. More...
 
EXTERNRT void rtxHexDumpToFile (FILE *fp, const OSOCTET *data, OSSIZE numocts)
 This function outputs a hexadecimal dump of the current buffer contents to a file. More...
 
EXTERNRT void rtxHexDumpToFileEx (FILE *fp, const OSOCTET *data, OSSIZE numocts, OSSIZE bytesPerUnit)
 This function outputs a hexadecimal dump of the current buffer to a file, but it may output the dump as an array of bytes, words, or double words. More...
 
EXTERNRT void rtxHexDumpToFileExNoAscii (FILE *fp, const OSOCTET *data, OSSIZE numocts, OSSIZE bytesPerUnit)
 This function outputs a hexadecimal dump of the current buffer to a file, but it may output the dump as an array of bytes, words, or double words. More...
 
EXTERNRT int rtxHexDumpToNamedFileNoAscii (const char *filename, const OSOCTET *data, OSSIZE numocts)
 This function outputs a hexadecimal dump of the current buffer contents to the file with the given name. More...
 
EXTERNRT void rtxHexDump (const OSOCTET *data, OSSIZE numocts)
 This function outputs a hexadecimal dump of the current buffer contents to stdout. More...
 
EXTERNRT void rtxHexDumpEx (const OSOCTET *data, OSSIZE numocts, OSSIZE bytesPerUnit)
 This function outputs a hexadecimal dump of the current buffer contents to stdout, but it may display the dump as an array or bytes, words, or double words. More...
 
EXTERNRT int rtxHexDumpToString (const OSOCTET *data, OSSIZE numocts, char *buffer, OSSIZE bufferIndex, OSSIZE bufferSize)
 This function formats a hexadecimal dump of the current buffer contents to a string. More...
 
EXTERNRT int rtxHexDumpToStringEx (const OSOCTET *data, OSSIZE numocts, char *buffer, OSSIZE bufferIndex, OSSIZE bufferSize, OSSIZE bytesPerUnit)
 This function formats a hexadecimal dump of the current buffer contents to a string, but it may output the dump as an array of bytes, words, or double words. More...
 
EXTERNRT int rtxHexDumpFileContents (const char *inFilePath)
 This function outputs a hexadecimal dump of the contents of the named file to stdout. More...
 
EXTERNRT int rtxHexDumpFileContentsToFile (const char *inFilePath, const char *outFilePath)
 This function outputs a hexadecimal dump of the contents of the named file to a text file. More...
 
EXTERNRT char * rtxHexDiffToDynString (OSCTXT *pctxt, const OSOCTET *pdata1, const OSOCTET *pdata2, OSSIZE numocts)
 This function generates a differences report between two binary data buffers. More...
 

Detailed Description

Function for printing binary data in hexadecimal text format and for doing binary to hexadecimal text conversion.

Function Documentation

◆ rtxByteToHexChar()

EXTERNRT int rtxByteToHexChar ( OSOCTET  byte,
char *  buf,
OSSIZE  bufsize 
)

This function converts a byte value into its hex string equivalent.

Parameters
byteByte to format.
bufOutput buffer.
bufsizeOutput buffer size.

◆ rtxByteToHexCharWithPrefix()

EXTERNRT int rtxByteToHexCharWithPrefix ( OSOCTET  byte,
char *  buf,
OSSIZE  bufsize,
const char *  prefix 
)

This function converts a byte value into its hex string equivalent.

The hex string for this function is prefixed with the given parameter.

Parameters
byteByte to format.
bufOutput buffer.
bufsizeOutput buffer size.
prefixThe string prefix.

◆ rtxHexDiffToDynString()

EXTERNRT char* rtxHexDiffToDynString ( OSCTXT pctxt,
const OSOCTET *  pdata1,
const OSOCTET *  pdata2,
OSSIZE  numocts 
)

This function generates a differences report between two binary data buffers.

The buffers are assumed to each contain the same number of bytes. The result of the comparison operation is returned in a dynamic allocated using the rtxMemAlloc function. The buffer may be freed using the rtxMemFreePtr function.

Parameters
pctxtPointer to context structure.
pdata1Pointer to first binary buffer to compare.
pdata2Pointer to second binary buffer to compare.
numoctsNumber of bytes to compare.
Returns
Result of comparison in dynamically allocated string buffer. Null means buffers have no differences. The format of the output is '[x]yy != zz, ...' where x is index and yy and zz are byte values.

◆ rtxHexDump()

EXTERNRT void rtxHexDump ( const OSOCTET *  data,
OSSIZE  numocts 
)

This function outputs a hexadecimal dump of the current buffer contents to stdout.

Parameters
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed.

◆ rtxHexDumpEx()

EXTERNRT void rtxHexDumpEx ( const OSOCTET *  data,
OSSIZE  numocts,
OSSIZE  bytesPerUnit 
)

This function outputs a hexadecimal dump of the current buffer contents to stdout, but it may display the dump as an array or bytes, words, or double words.

Parameters
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed.
bytesPerUnitThe number of bytes in one unit. May be 1 (byte), 2 (word), or 4 (double word).

◆ rtxHexDumpFileContents()

EXTERNRT int rtxHexDumpFileContents ( const char *  inFilePath)

This function outputs a hexadecimal dump of the contents of the named file to stdout.

Parameters
inFilePathName of file to be dumped.

◆ rtxHexDumpFileContentsToFile()

EXTERNRT int rtxHexDumpFileContentsToFile ( const char *  inFilePath,
const char *  outFilePath 
)

This function outputs a hexadecimal dump of the contents of the named file to a text file.

Parameters
inFilePathName of file to be dumped.
outFilePathName of file to which dump contents will be written.

◆ rtxHexDumpToFile()

EXTERNRT void rtxHexDumpToFile ( FILE *  fp,
const OSOCTET *  data,
OSSIZE  numocts 
)

This function outputs a hexadecimal dump of the current buffer contents to a file.

Parameters
fpA pointer to FILE structure. The file should be opened for writing.
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed

◆ rtxHexDumpToFileEx()

EXTERNRT void rtxHexDumpToFileEx ( FILE *  fp,
const OSOCTET *  data,
OSSIZE  numocts,
OSSIZE  bytesPerUnit 
)

This function outputs a hexadecimal dump of the current buffer to a file, but it may output the dump as an array of bytes, words, or double words.

Parameters
fpA pointer to FILE structure. The file should be opened for writing.
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed.
bytesPerUnitThe number of bytes in one unit. May be 1 (byte), 2 (word), or 4 (double word).

◆ rtxHexDumpToFileExNoAscii()

EXTERNRT void rtxHexDumpToFileExNoAscii ( FILE *  fp,
const OSOCTET *  data,
OSSIZE  numocts,
OSSIZE  bytesPerUnit 
)

This function outputs a hexadecimal dump of the current buffer to a file, but it may output the dump as an array of bytes, words, or double words.

This function never contains an ASCII dump.

Parameters
fpA pointer to FILE structure. The file should be opened for writing.
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed.
bytesPerUnitThe number of bytes in one unit. May be 1 (byte), 2 (word), or 4 (double word).

◆ rtxHexDumpToNamedFile()

EXTERNRT int rtxHexDumpToNamedFile ( const char *  filename,
const OSOCTET *  data,
OSSIZE  numocts 
)

This function outputs a hexadecimal dump of the current buffer contents to the file with the given name.

The file is opened or created and then closed after the writer operation is complete.

Parameters
filenameFull path to file to which data should be output.
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed
Returns
Status of operation: 0 for success or negative error code.

◆ rtxHexDumpToNamedFileNoAscii()

EXTERNRT int rtxHexDumpToNamedFileNoAscii ( const char *  filename,
const OSOCTET *  data,
OSSIZE  numocts 
)

This function outputs a hexadecimal dump of the current buffer contents to the file with the given name.

The file is opened or created and then closed after the writer operation is complete. The dump in this case has no ASCII part which makes it easier to import into hex editor tools.

Parameters
filenameFull path to file to which data should be output.
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed.
Returns
Status of operation: 0 for success or negative error code.

◆ rtxHexDumpToString()

EXTERNRT int rtxHexDumpToString ( const OSOCTET *  data,
OSSIZE  numocts,
char *  buffer,
OSSIZE  bufferIndex,
OSSIZE  bufferSize 
)

This function formats a hexadecimal dump of the current buffer contents to a string.

Parameters
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed.
bufferThe destination string buffer.
bufferIndexThe starting position in the destination buffer. The formatting of the dump will begin at this position.
bufferSizeThe total size of the destination buffer.
Returns
The length of the final string.

◆ rtxHexDumpToStringEx()

EXTERNRT int rtxHexDumpToStringEx ( const OSOCTET *  data,
OSSIZE  numocts,
char *  buffer,
OSSIZE  bufferIndex,
OSSIZE  bufferSize,
OSSIZE  bytesPerUnit 
)

This function formats a hexadecimal dump of the current buffer contents to a string, but it may output the dump as an array of bytes, words, or double words.

Parameters
dataThe pointer to a buffer to be displayed.
numoctsThe number of octets to be displayed.
bufferThe destination string buffer.
bufferIndexThe starting position in the destination buffer. The formatting of the dump will begin at this position.
bufferSizeThe total size of the destination buffer.
bytesPerUnitThe number of bytes in one unit. May be 1 (byte), 2 (word), or 4 (double word).
Returns
The length of the final string.