in reply to Assigning a file to an Array.

You didn't check the result of open. I've no idea whether that's related to your problem, but soon after the open, your code becomes unreadable.