I'm missing something inherently obvious here, because it looks like nothing is being read out of that file in your readData function, but totalLines works just fine.
For some strange reason, some posters go back and edit their original post when their problem is solved. It's unfortunate because now the thread is useless to anyone with a similar problem.
Me neither. In fact, so many of us don't understand it that we have an active thread in the lounge about how to get rid of this sort of behavior (via limiting editing rights).
I suspect it is an attempt to hide getting help on homework problems from the teacher. Either way, I'm sure there's nothing ground breaking that we're missing out on.