cbytes.c 235 B

12345678910111213141516
  1. #include <stdio.h>
  2. int main()
  3. {
  4. char ch;
  5. int loop = 0;
  6. while (scanf("%c",&ch) == 1) {
  7. printf("0x%02x,",255 & (int) ch);
  8. if (++loop == 16) {
  9. loop = 0;
  10. printf("\n");
  11. }
  12. }
  13. printf("0x00\n");
  14. return 0;
  15. }