Obviously one could loop through a file using fgetl or similar function and increment a counter, but is there a way to determine the number of lines in a file without
I would recommend using an external tool for this. For example an app called cloc, which you can download here for free.
On linux you then simply type cloc and get
YourPC$ cloc
87 text files.
81 unique files.
23 files ignored.
http://cloc.sourceforge.net v 1.60 T=0.19 s (311.7 files/s, 51946.9 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
MATLAB 59 1009 1074 4993
HTML 1 0 0 23
-------------------------------------------------------------------------------
SUM: 60 1009 1074 5016
-------------------------------------------------------------------------------
They also claim it should work on windows.