Click here to Skip to main content
Click here to Skip to main content

Counting Lines in a MS VC++ 6.0 project

, 4 Aug 2001
Rate this:
Please Sign up or sign in to vote.
A program that counts the lines (source, comments, blank) in every file included in a MS VC++ 6.0 project
<!-- Download Links --> <!-- Article image -->

Sample Image - LineCounter.gif

<!-- Main HTML starts here -->


Ever wondered how many lines a project you have worked on for a month (or maybe for a year!)? Well, we did this for you Smile | :)

This program (LineCounter) was developed with one purpose only: to count your lines!

The program is able to count source code, comments (both styles: "// comment" and "/* comment */"), and blank lines. It shows the results in a couple of editboxes, and has a preview window (right click on the list).

The program opens the project file (.dsp) and throws it through the parsing code. After parsing is done the list of project files is steped-by-step and lines are counted.

That's it! The source code is pretty self explanatory, so I guess you'll manage.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author


United States United States
No Biography provided

Comments and Discussions

GeneralMy vote of 3 Pinmemberjyl_hrb17-Apr-11 22:41 
Questionhow to use the code counter in perl? Pinmembermoaweah naser17-Jul-07 21:27 
AnswerRe: how to use the code counter in perl? PinmemberAS-codeproject14-Aug-07 13:09 
GeneralSome Modifications I would suggest PinmemberRay Steel13-Oct-04 14:44 
Generalthis is definitely a useful tool, and... PinmemberZhefu Zhang2-Dec-03 9:10 
GeneralRe: this is definitely a useful tool, and... PinsussAnonymous16-Sep-04 23:05 
Generalyour program is not counting lines correctly Pinmemberevilman1-Feb-03 10:33 
Ok so I just wrote a simple FTP server and I wanted to know how much lines I used.
Anyway, it seems that your program doesn't count lines for all C++ styles. A file with 664 lines returned 0 lines in every fields. thats not normal.
The files that were counted incorrectly were not written by me, but they do compile.
Oh and I don't like your user interface. The menu's are simply not useful and there shouldnt be any Count item. simply count the lines on file open. Its just a waste of time for the poor user.
oh well.
heres a sample of my stack.cpp (which returns 0 lines, I can guarantee that its wrong):

#include "stack.h"
int StackNotEmpty(stk_stack * theStack) {
return( theStack ? (int) theStack->top : 0);
stk_stack * StackJoin(stk_stack * stack1, stk_stack * stack2) {
if (!stack1->tail) {
} else {

Questionwhy? PinmemberIvan Tsygoulyov25-Dec-02 0:24 
GeneralMmmmh... PinmemberRage26-Nov-02 5:45 
Questiondoes anyone really need this? Pinmemberkokie19-May-02 10:03 
AnswerRe: does anyone really need this? PinmemberDoug Kimzey20-May-02 10:27 
GeneralRe: does anyone really need this? PinmemberPerFnurt6-Feb-04 16:24 
AnswerRe: does anyone really need this? PinmemberAnonymous28-May-02 14:45 
AnswerRe: does anyone really need this? PinmemberNelno18-Dec-02 16:27 
GeneralRe: does anyone really need this? PinmemberDimitris Vassiliades19-Mar-03 9:40 
GeneralIt is not bad, Indeed it is much useful than that upstair guy whose article is 3- pt PinmemberZhefu Zhang11-Nov-03 12:11 
GeneralHmm, .dsw PinmemberRazvan Marcus12-Dec-01 4:19 
GeneralGood work PinmemberRejeesh.T.S9-Aug-01 0:09 
QuestionAnd those constructions? PinmemberAnonymous6-Aug-01 12:19 
GeneralTeacher caught me using Java... PinmemberStephen Kellett6-Aug-01 12:01 
GeneralRe: Teacher caught me using Java... Pinmemberck6-Aug-01 12:20 
GeneralRe: Teacher caught me using Java... PinmemberPaul Evans25-Mar-03 6:41 
QuestionIt's a dupe? PinmemberGeorge5-Aug-01 17:46 
AnswerRe: It's a dupe? Pinmember_declspec5-Aug-01 22:25 
GeneralRe: It's a dupe? PinmemberBrian V Shifrin6-Aug-01 13:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 5 Aug 2001
Article Copyright 2001 by _declspec
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid