LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How many lines of code in my program?

Is there a way to find out just how many lines your code has, preferable, the whole project or workspace.

Thanks
0 Kudos
Message 1 of 3
(3,427 Views)
Hello Rafi,

There is a way to count the number of lines in a source file programmatically. You would use the NI LabWindows/CVI Server 7.0 instrument (Tools >> Create ActiveX Controller >> Next >> NI LabWindows/CVI Server 7.0).
This instrument will allow you to access functions to report on the CVI environment.

In particular, you would use the CVI_AppGetNumberOfLinesInFile (...). This function takes in an handle to a CVI application and a source file and returns the number of lines in the given source file. You would get the object handle for the current open CVI application by calling ActiveApp (...).


Thanks. I hope that helps.
Wendy L
LabWindows/CVI Developer Newsletter
Message 2 of 3
(3,412 Views)

Hi All,

 

Coming back to this super old thread to share an example code I created from the suggestion given above!

 

Attached is a CVI project of a simple command-line application that can list and count the number of lines of code of all Source Code Files in a given CVI project.

 

Here is an image exemplifying this application running.

 

SLOC number in CVI.png

 

I hope that helps!

Felipe Flores
Technical Support Engineer
National Instruments
0 Kudos
Message 3 of 3
(1,726 Views)