[ create a new paste ] login | about

Link: http://codepad.org/dY9sXElk    [ raw code | output | fork ]

C++, pasted on Jun 23:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cstdio>

int main()
{
  char s[] = "3545af123123123123fa412563fbc123";
  int length = sizeof(s) - 1;

  if (length > 0)
  {
    for (ptrdiff_t i = 0; i < length; i += 2)
    {
      unsigned r = 0;

      sscanf(s + i, "%2x", &r);
      printf("0x%2X ", r);
    }
  } 
}


Output:
1
0x35 0x45 0xAF 0x12 0x31 0x23 0x12 0x31 0x23 0xFA 0x41 0x25 0x63 0xFB 0xC1 0x23 


Create a new paste based on this one


Comments: