0

The problem:

  • I have a char array char myCharArray[] = "0x77" that I need to convert to become the same as uint8_t = 0x77.

I have tried all sort of things but ran out of ides. Can this be done, and if so can I get some help please.

Thanks in advance

Misha
  • 556
  • 1
  • 8
  • 25
  • 4
    This seems exactly what you need: [Convert hex string (char \[\]) to int?](https://stackoverflow.com/questions/10156409/convert-hex-string-char-to-int) – Marco Bonelli Jan 21 '20 at 22:15

1 Answers1

0

@Marco Bonelli, Thank you it worked. The following solved my problem:

uint8_t addr = (uint8_t)strtol(buffer, NULL, 0);

Misha
  • 556
  • 1
  • 8
  • 25