How do I convert a string representation of a hex to its hex value in c?

If I have

char input[50] = "xFFFF";
int a;

How can I store the numerical value of input in a? the language is C.


One way to do it might be:

if (sscanf(input, "x%x", &a) == 0) {
    /* matching failed */

If your input uses a real hex specifier (like "0xFFFF") you can just use %i:

if (sscanf(input, "%i", &a) == 0) {
    /* matching failed */

Need Your Help

Get outlook recurrence pattern of a event in iCal format using C#

android icalendar rfc2445 outlook-calendar rfc5545

I am developing a system which extract the outlook calendar data and save it on android device calendar. Up to now all other outlook data are extracted and saved successfully. Now I need to create

How to locate the text of table header at center in CSS3?

html css html5 css3

How can I locate the text of HTML5 table header at center in CSS3?