In the future please put your code in code tags. Your code will be much more readable, and people will be more inclined to help you. Sorry, i do not know the answer. It has been a while since i have done stuff with reading files and the like.
Duct tape is like the Force. It has a dark side, a light side, and it binds the whole universe together.