I want to read a file that contains this (example):
194920392038122341
int n = 0;
vector<int> numbers;
ifstream in
in.open("input.txt");
while (in >> n)
{
numbers.push_back(n);
}
int* array = &numbers[0];
Here's how I would do it:
char n = 0;
vector<int> numbers;
ifstream in("input.txt");
while (in.get(n)) {
if(std::isdigit(n) {
numbers.push_back(n - '0');
}
}
int* array = &numbers[0];