char strtmp[1024*6] = {'\0'};
for( int i = 0 ; i < nmsg.head.len; i++)
{
char tmp[128] = {'\0'};
if( (i+1) % 16 != 0 )
sprintf(tmp," %2x ",0xff & nmsg.buf[i] );
else
sprintf(tmp,"\n %2x ",0xff & nmsg.buf[i] );
strcat(strtmp,tmp);
}
for( int i = 0 ; i < nmsg.head.len; i++)
{
char tmp[128] = {'\0'};
if( (i+1) % 16 != 0 )
sprintf(tmp," %2x ",0xff & nmsg.buf[i] );
else
sprintf(tmp,"\n %2x ",0xff & nmsg.buf[i] );
strcat(strtmp,tmp);
}
strcat(strtmp,"\n");
printf("%s",strtmp);