Hi Tomazas,
If you are using a C++11 compiler that supports lambda functions...such as Visual Studio 2010 then you can do this with only a few lines of code:
unsigned char rnd[14]={0xDE ,0x75 ,0x27 ,0xA0 ,0x72 ,0xAB ,0x83 ,0x72 ,0xF2 ,0x7D ,0x34 ,0x3C ,0xAC ,0x36};
vector<unsigned char> v;
v.assign(rnd,rnd+_countof(rnd));
std::for_each(v.begin(), v.end(), [](unsigned char c){std::cout << hex << uppercase << (int)c;});
With an older C++ compiler you could use a functor:
void print(unsigned char c)
{
std::cout << hex << uppercase << (int)c;
}
unsigned char rnd[14]={0xDE ,0x75 ,0x27 ,0xA0 ,0x72 ,0xAB ,0x83 ,0x72 ,0xF2 ,0x7D ,0x34 ,0x3C ,0xAC ,0x36};
vector<unsigned char> v;
v.assign(rnd,rnd+_countof(rnd));
std::for_each(v.begin(), v.end(),print);