vico
vico

Reputation: 18191

atoi() from hex representation string

Need to make int from hex representation string like "0xFA" or better "FA". Need something like atoi("FA"). Is there are any standard solutions for that?

Upvotes: 42

Views: 101132

Answers (1)

V-X
V-X

Reputation: 3029

Try to use strtol():

strtol("FA", NULL, 16);

Upvotes: 89

Related Questions