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
  • 60,763
  • 5
  • 37
  • 77
RtroN
  • 21
  • 1
  • 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
  • 223,800
  • 12
  • 181
  • 301