You will have to either use something like atoi() (nonstandard IIRC), or parse it yourself. If you are using C++, you could use a stringstream to make it easier.
Tell me you're not actually suggesting using static_cast<> to parse a string to an integer. Or at least tell me you see the problem with using a static cast to convert a value available only at run time.