0

I tried using decimal and hexadecimal strings to create a CFDataRef, but what I created not what I need. I need a CFDataRef like "<b1a3c3 d4b5>", Here is my code:

CFDataRef abc = CFDataCreate(kCFAllocatorDefault, "b034958b0c6f",strlen("b034958b0c6f"));
CFDataRef abc = CFDataCreate(kCFAllocatorDefault, "4294967295", strlen("4294967295"));
Larme
  • 24,190
  • 6
  • 51
  • 81
0x11901
  • 339
  • 1
  • 14

1 Answers1

1

@kevin is correct, you need to pass the raw bytes.

UInt8 bytes[] = { 0xb1, 0xa3, 0xc3, 0xd4, 0xb5 };
CFDataRef abc = CFDataCreate(kCFAllocatorDefault, bytes, sizeof(bytes));
Leland Wallace
  • 228
  • 1
  • 5