/*
* =====================================================================================
*
* Filename: sstream.cpp
*
* Description:
*
* Version: 1.0
* Created: 2015å¹´04æ06æ¥ 14æ¶41å38ç§
* Revision: none
* Compiler: gcc
*
* Author: zt (),
* Organization:
*
* =====================================================================================
*/
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main ( int argc, char* argv[] )
{
( void ) argc;
( void ) argv;
uint8_t temp[42] = { 0x1, 0x2, 0x3, 0x5, 0x99};
uint8_t pDmdHsg[42] = { 0x11, 0x3, 0x3, 0x5, 0x99};
auto f = [&] ( uint8_t* p1, uint8_t* p2, int num )
{
for ( int i = 1; i < num; i += 2 )
if ( p1[i] != p2[i] )
return false;
return true;
};
cout << f ( temp, pDmdHsg, 42 ) << endl;
#if 0
stringstream sx, sd;
for ( int j = 0; j < 42; ++j )
{
sx << "0x" << std::hex << std::setw ( 2 ) << std::setfill ( '0' ) << ( int ) temp[j] << " ";
sd << "0x" << std::hex << std::setw ( 2 ) << std::setfill ( '0' ) << ( int ) pDmdHsg[j] << " ";
}
cout << sx.str() << endl;
cout << sd.str() << endl;
#endif
return 0;
}