StrOps::OtoX( const unsigned char *, int, StrBuf & )

Convert an octet stream into hex.

Virtual?

No

 

Class

StrOps

 

Arguments

char *octet

the input stream

 

int len

length of the input in bytes

 

StrBuf &x

the output string

Returns

void

 

Notes

This function converts the input stream into a string of hexadecimal numbers, with each byte from the input being represented as exactly two hex digits.

Example

const unsigned char stream[3] = { 'f', 'o', 'o' };
StrBuf hex;
StrOps::OtoX( stream, 3, hex );
StrOps::Dump( hex );
return 0;

Executing the preceding code produces the following output:

% a.out
666F6F