What am I doing wrong?
You are expecting to be able to re-read your file each time you iterate your for loop. But that is not how IO works (in any language).
Files read from beginning to end and then stop.
If you want to re-read your file each time around your for loop, you will need to either:
- Re-open the file each time.
Ie. put the open & close inside the for loop.
- Or "rewind" the file each time you iterate the for loop.
Ie. Add a line: seek NB_FILE, 0, 0; as the first line inside the for loop.
See seek() for details.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.