1st of all use code tags. and for reading from particular line you need to set file pointer to that particular point and then start reading.

read char by char and if '\n' found ie: the line break increment an int counter by 1. now set the file pointer on the desired count ie: line no.

and really there is no link between your qus and posted code.