Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 10-02-2007, 12:00 PM   #1 (permalink)
simple's Avatar
 
True Techie

Join Date: Jan 2006

Location: Earth

Posts: 171

simple

Default lines of code

i want a program in C language only which counts the source lines of code of a C program. (i want only C language). For more info check out..
Source lines of code - Wikipedia, the free encyclopedia
i searched quite a lot but was unable to find a program for C language only.
any help would be sincerely appreciated .....
thanks in advance.....c ya!!
__________________
<A HREF=http://ubanimator.com><IMG SRC=http://img182.imageshack.us/img182/5168/userbar511415cb2.gif><A>
simple is offline  
Old 10-02-2007, 01:00 PM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: lines of code

Is this homework?
jaeusm is offline  
Old 10-06-2007, 02:37 PM   #3 (permalink)
simple's Avatar
 
True Techie

Join Date: Jan 2006

Location: Earth

Posts: 171

simple

Default Re: lines of code

i guess you can say it is a homework (actually it is an assignment). but just because it is 'given' to me doesnt mean i dont want to learn about it and do it myself. its just that i am not able to get any starting steps and i am really pressed for time..
thanks again....c ya!!
__________________
<A HREF=http://ubanimator.com><IMG SRC=http://img182.imageshack.us/img182/5168/userbar511415cb2.gif><A>
simple is offline  
Old 10-06-2007, 02:59 PM   #4 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: lines of code

Why does it have to be C only?

EditPlus supports almost every language and counts lines...
__________________

Need website help? PM me!
CrazeD is offline  
Old 10-08-2007, 12:53 AM   #5 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default Re: lines of code

Here's a tip.

Check for the extension on the file (C files have a .c on the end)
Then to count the # of lines, open the file and loop using the readline() function

If it's meant to be more elaborate, let us know. We can help with more ideas, but you probably won't get any code written out here for ya.
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 10-08-2007, 07:19 PM   #6 (permalink)
farinha's Avatar
 
Super Techie

Join Date: Aug 2007

Location: Portugal

Posts: 311

farinha is on a distinguished road

Default Re: lines of code

if you mean instructions, delimited by ';', just count the number of ';' in the file, you can use fscanf to do it.
If you mean the number o lines in the file count the number of '\n'.
To know if you have reached the end of the file compare the result of fscanf with EOF, end of file.
farinha is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange horizontal lines after videos/gaming sewildman50 Hardware Troubleshooting 4 07-02-2007 10:09 AM
Someone take a look at my Java code PnkFloyd27 Programming Discussions 4 06-21-2007 08:11 PM
NEED help with a Javascript code...(mouseover and stuff) Quintox Web Graphics, Design, Digital Images 7 05-02-2007 06:41 PM
JavaScript Botnet Code Leaked To Internet Osiris Virus - Spyware Protection / Detection 0 04-02-2007 09:05 PM