If you can rely on your input being formatted like that, just dump it in a stringstream and read it back.
const string res = "640x480x32"; int height, width, depth; char delimiter; stringstream stream(res); stream >> height >> delimiter >> width >> delimiter >> depth;
You could use getline and define 'x' as a delimiter, but then you get each number as a string and still need to convert to int.
You could use .ignore(1) instead of the dummy character, but it will look horrible to read.