Dear all,
I need to read the number of lines in a file before doing some operations on that file. When I try to read the file and increment the line_count variable at each iteration until i reach eof. It was not that fast in my case. I used both ifstream and fgets . They were both slow . Is there a hacky way to do this, which is also us...
I need to get a line count of a large file (hundreds of thousands of lines) in python. What is the most efficient way both memory- and time-wise?
At the moment I do:
def file_len(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass
return i + 1
is it possible to do any better?
...
Suppose you open a file, and do an seek() somewhere in the file, how do you know the current file line ?
(I personally solved with an ad-hoc file class that maps the seek position to the line after scanning the file, but I wanted to see other hints and to add this question to stackoverflow, as I was not able to find the problem anywhere...
Our app at work is a huge project with over 3000 units, weighing in about 3.5 million lines of code.
...or at least it was when we were compiling it under D2007. We recently updated to D2010, and now if we run a full build, the line count finally stops at about 4.9 million. Same DPR, same code base, same everything, but the compiler's...
When building a project there are two places where source line count is reported:
On the compile progress dialog
Under Project | Information
In Delphi 2007 these two numbers were identical for the project we are building.
In Delphi 2010 these two numbers are wildly different. The (1st) count is larger by a count of 1 million lines o...
I am trying to create a program which, given an input file, returns the count of all the lines of code in the input file, excluding blank lines and comment lines. I have written the following code, however I need help with how to exclude lines containing comments and blank lines.
#include<stdio.h>
int main()
{
int count;
char ch...
When the size of a code base is reported in lines, is it more usual/standard to report raw wc count, or nonblank noncomment lines? I'm not asking which measure should be used, only, if I see a number given with no other information, which measure it is at best guess more likely to be.
...