You could use a stringstream, or strtol().