In order to solve Euler Project 8 without resorting to a "Big Number" library, I would like to read the separate digits in an txt.-file to separate spots in an array. The digits in the txt.-file are arranged as follows:
094239874......29837429837 [50 of them],
192319274......12837129873 [50 of them]
such that there are in total 20 lines with 50 digits, all separated by enters. So I am trying to write a program which writes the first digits to the first spot in the array and continues this process (paying attention to the spaces) until the 1000th digit. I have tried finding solutions to this problem in tutorials and elsewhere online, but I cannot make it work for this specific example. Up to now I have something like
int main() {
int array[999];
string trial[999];
ofstream myfile;
myfile.open ("example.txt");
for(i=1 ; i<=1000 ; i++) {
myfile >> trial;
// Somehow convert string to int as well in this loop?
}