c char* to int(with 0)

Write your question here.

1
2
3
4
  int x= 0x00123ABC//RESULT IS 1194684

  //CHAR EXAMPLE
  char *c="0x00123ABC"


How can i convert a char* to int so i can get values like that. The problem is that all the already determined ways dont work, they just ignore whitespaces(0). I cant use <string> if i could i would be sleeping right now haha.
Got it. As soon as i changed my google search from "char to int c" to "hex char to int c" i got what i needed.

this is how to do it.

char *c="0x00123SBC"
int x= (int)strtol(c, NULL, 0);


There you, hope helps someone.
Topic archived. No new replies allowed.