Anyone got a best way of doing this.
Trying to count number of lines of code in a C++ file but need to remove comments, comments in C++ are either one line starting // or multi-line between /* and */.
The one liners are ok but bit stuck as best way to ignore the multi liners.
I have this so far.
So I need to add something like,
Trying to count number of lines of code in a C++ file but need to remove comments, comments in C++ are either one line starting // or multi-line between /* and */.
The one liners are ok but bit stuck as best way to ignore the multi liners.
I have this so far.
Code:
sub openfile1(fop)
Set objInputFile = objFSO.OpenTextFile(fop)
do until objInputFile.atendofstream
fname = objInputFile.readline
if fname <> "" then
if left(fname,2) <> "//" then
c= c + 1
end if
end if
loop
fl.Write(fop & " " & c) & vbcrlf
end sub
So I need to add something like,
Code:
if left(fname,2) = "/*" then
Do until left(fname,2) = "*\"
objInputFile.skipline
loop
end if