Do you know the maximum number of records in your binary file?
How about defining your array to have that many elements.