String to Int? Dropping quotes from a "hex"

Can someone explain clearly how to convert a string (like "0xff9933") into a usable integer??? All I really need to do is drop the quotes. I know internally it's more complicated than that, but it can be that complicated.

I'm working on an LED matrix display where the patterns are saved on an SD card. For some dumb reason it seems like this hasn't been done before. At least I can't find it. I have everything mostly worked out except how to turn the hex values (which are saved in txt files) into usable data.

I've been going out of my mind here and spending many hours digging through Arduino and C++ posts. This is driving me nuts. Any help would be greatly appreciated.

Are you treating the result as signed or unsigned? Depending on that answer:
strtol() or strtoul() are two possiblities.

EDIT:
You'll need to use c-string functions or array indexing to get rid of the double quotes first. Or perhaps drop them as they're read in from the SD card.

output

16750899

void
setup (void)
{
    Serial.begin (9600);

    const char *s = "0xff9933";
    unsigned long val;
    sscanf (s, "%lx", & val);

    Serial.println (val);
}

void
loop (void)
{
}

@tj_090's post implies that the data from the SD card contains the actual double quotes:

So:

  const char *s = "\"0xff9933\"";

Which causes sscanf to choke:

void setup (void) {
  Serial.begin (115200);

  const char *s = "\"0xff9933\"";
  unsigned long val;
  sscanf (s, "%lx", & val);

  Serial.println(s);
  Serial.println (val);
}

void loop (void) {
}

Output:
"0xff9933"
0

sorry. add the quotes to the sscanf format string

void
setup (void)
{
    Serial.begin (9600);

    const char *s = "\"0xff9933\"";
    unsigned long val;
    sscanf (s, "\"%lx\"", & val);

    Serial.println (val);
}

void
loop (void)
{
}

It would be good if you were to confirm exactly how it's saved on the SD card and how you extract it