roboticus@Boink~ $ cat 876421.cpp #include unsigned char inbuf[]="Now is the time for all "; unsigned char outbuf[50]; void hexdump(unsigned char *p, int n) { for (int i=0; i> 6; *dst++ = *src++ & 0x3f; st = 1; break; case 1: *dst++ = ((*src&0x0f)<<2) | rem; rem = *src++>>4; st = 2; break; case 2: *dst++ = ((*src&0x03)<<4) | rem; *dst++ = *src++>>2; st = 0; break; } } hexdump(outbuf, dst-outbuf); } roboticus@Boink~marco@Boink:~ $ gcc 876421.cpp -lstdc++ roboticus@Boink:~ $ ./a.out 4e 6f 77 20 69 73 20 74 68 65 20 74 69 6d 65 20 66 6f 72 20 61 6c 6c 20 00 0e 3d 36 1d 20 24 36 1c 20 10 07 1a 25 01 02 1d 29 35 16 19 20 18 36 1b 32 01 12 18 2c 31 06 08 00