0

I have a variable of type char [] with an address. Example: char addr[11] = "0x01234567";. How do I convert this variable to type uintptr_t?

I want it to be equivalent to uintptr_t add = 0x01234567;.

Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
RtroN
  • 21
  • 2
  • 4

1 Answers1

1

"0x01234567" is a textual representation of an integer. std::uintptr_t is an integer type. You can use any standard formatted input functions to do the conversion. There are several options, but I recommend starting with a string stream.

eerorika
  • 232,697
  • 12
  • 197
  • 326