//---------------------------------------------------------------------------// #ifndef HEXSHOW #define HEXSHOW #include //---------------------------------------------------------------------------// namespace hex { void show(std::vector &mydata, unsigned long int width = 32, unsigned long int startidx = 0, unsigned long int breakidx = 512) { // check input assert ( startidx <= breakidx ); breakidx = ( breakidx > mydata.size() || breakidx == 0 ) ? mydata.size() : breakidx; // introduce additional line break std::cout<<"\n"; // declare two stringstreams for hexadecimal and ASCII output std::stringstream sshex, sschr; // count bytes unsigned long int idx = 0; // process data for ( std::size_t i = startidx; i < breakidx; i++ ) { unsigned char el = mydata[i]; // hex representation if ( (idx+0)%width == 0 ) { sshex< 0x1f && (int)el < 0x7f) ? el : '.'; sschr<