Is there any way to find out the length of a txt file ( number of lines)?

I need to be able to find this out in order to poplate an array with an unspecified amount of data from a txt file.