i have a txt file full of numbers and i just want to take the first 5 digits, save it has one number, shift over 1 digit, take another 5 digits, save it, and so on until the end of the file

here is the code

Code:

fstream Prime;
Prime.open("digitsofe.txt");
if (!Prime.is_open()) { cout << "unable to open"; }
else if (Prime.is_open()) {
cout << "File opened successfully\n";
Prime.getline(str2,6);
cout << str2 << endl;
Prime.seekg(1);
Prime.getline(str2,6);
cout << str2;
Prime.close();
}

right now i'm just trying to print the first 5 digits and then the next 5 digits but the second number won't print. what am i doing wrong?

I tried using the get function but using atoi kept giving errors.