You need to seek back to the beginning of your file before reading it the second time.
In reply to Re: Mixed-up output by eg in thread Mixed-up output by Nimster