Text file help

Pages: 12
You did? Try changing it to std::cout << text[i] << "\n";
I've created a text file with the numbers from 1-450. After writing code to retrieve and print out the contents in the text file, the compiler only printed out the numbers 124-450. Is there a reason why this is happening?


Consoles generally only retain a limited number of lines of text. If you're printing 450 lines at one time, there is a good probability that you just can't scroll up far enough to see the first lines because they weren't retained by the console. That doesn't have anything to do with your code.
Is there a way to see all 450 lines?
Once it loop is at 225, put a std::cin.get() then a std::cin.ignore()

It will stop at the half way point, then just hit enter and it will display the other half.
Is there a way to see all 450 lines?


The easiest way would be to redirect the output to a file and inspect the file when the program is done. Alternately, you could interrupt the output temporarily as Fredbill suggests or possibly adjust your console settings so that more lines are retained.
Topic archived. No new replies allowed.
Pages: 12