|
ReadFile() is a function which loads the entire file into an array. Functions don't return until they have finished, so your code which displays the results also cannot execute until the entire file has been read.
The function is building a version of the file in memory. This means that for every line read, it has to manipulate the data that it already has. As you get further into the file this gets less and less efficient, and at the same time you are using up a lot of memory so your computer starts to struggle with all it's tasks.
For this reason, nothing will appear on your screen for a long time.
As you've seen, ReadFile() is a great convenience for small files, but not a good choice for large files where you only want to perform a serial read.
Jooels recommendation was to add debug code to the ReadFile() function, not your calling code.
|