Is there a way to count the number of lines in my file using C?
See Question&Answers more detail:osIf you are referring to the line number within your c source, most compilers support the __LINE__
macro.
If you want to count line numbers of arbitrary text files in c, the following functions should be starting points:
Combining these into a line counter is left as an exercise to the reader :)