MemoryAccessor 1
A command-line front-end for exploring virtual memory of a linux process by accessing /proc/PID/mem file.
Loading...
Searching...
No Matches
HexViewer Class Reference

A class for printing data in a readable format. More...

#include <hexviewer.h>

Public Member Functions

void PrintHex (std::ostream *stream_p, const char *s, size_t size, size_t addr, bool show_hex=false) const noexcept
 Print data in readable format.
 

Detailed Description

A class for printing data in a readable format.

This class provides an opportunity to print in readable format any array of char (bytes) to any ostream, optionally showing the hexadecimal values of bytes.

Member Function Documentation

◆ PrintHex()

void HexViewer::PrintHex ( std::ostream * stream_p,
const char * s,
size_t size,
size_t addr,
bool show_hex = false ) const
noexcept

Print data in readable format.

Parameters
[in,out]stream_pstd::ostream to which output should be printed.
[in]sArray of char with data to be processed.
[in]sizeSize of the array of char.
[in]addrStart address to print to output.
[in]show_hexTo show hex values of bytes or not.

Print data line be line replacing non-printable characters by '.'. If show_hex is true, hex values are shown. Also, address provided in parameter "address" is printed in hex with offset in each line. The width of each line is base_width_ multiplied by 2 in power as much as screen width can contain when show_hex is true, otherwise width is additionally multiplied by 4.


The documentation for this class was generated from the following files: