Is there a way to count the number of lines in my file using C?
Try the wc command. Most linux distributions include it.
wc