fluffy/hex.c

28 lines
298 B
C
Raw Normal View History

2017-08-08 18:14:02 -06:00
#include <stdio.h>
int
main(int argc, char *argv[])
{
size_t count;
for (count = 0; ; count += 1) {
int c = getchar();
if (EOF == c) {
break;
}
if (count) {
2017-08-08 18:14:02 -06:00
putchar(' ');
if (0 == count % 8) {
putchar(' ');
}
2017-08-08 18:14:02 -06:00
}
printf("%02x", c);
2017-08-08 18:14:02 -06:00
}
putchar('\n');
return 0;
}