Because of the complexities of the delimiters here (you seem to have spaces and non-numeric characters) I'd use the string splitting available in the boost library:
http://www.boost.org/
This allows you to split using regular expressions as delimiters.
First, pick the delimiter which is a regular expression:
boost::regex delim(" "); // I have just a space here, but you could include other things as delimiters.
Then extract as follows:
std::string in(" 65 865 1 3 5 65 234 65 32 ");
std::list<std::string> out;
boost::sregex_token_iterator it(in.begin(), in.end(), delim, -1);
while (it != end){
out.push_back(*it++);
}
So you can see I've reduced it to a list of strings. Let me know if you need to do the whole step to an array of integers (not sure what array type you want); happy to include that too if you want to go the boost way.