Dharanyadevi blogspot subsume with E-books, Notes, Lab Manual, Question Banks, Interview Tips, Viva Questions, Basics and Interview Questions for engineering students. For Any Help Contact dharanyadevi@gmail.com

SEARCH

Image

Thursday, April 12, 2012

Write a C Program to Count the Number of Character ,Number of Lines from a Text File and Display the Result

#include
#include
void main()
{
int noc=0,now=0,nol=0;
FILE *fw,*fr;
char fname[20],ch;
clrscr();
printf("\n enter the source file name");
gets(fname);
fr=fopen(fname,"r");
if(fr==NULL)
{
printf("\n error \n");
exit(0);
}
ch=fgetc(fr);
while(ch!=EOF)
{
noc++;
if(ch==' ');
now++;
if(ch=='\n')
{
nol++;
now++;
}
ch=fgetc(fr);
}
fclose(fr);
printf("\n total no of character=%d",noc);
printf("\n total no of words=%d",now);
printf("\n total no of lines=%d",nol);
getch();
}

11 comments:

  1. When someone writes an post he/she keeps the idea of a user in his/her
    brain that how a user can be aware of it. Therefore that's why this paragraph is amazing.
    Thanks!

    My web site - digital camera advice - http://www.digitalcameratips.co.uk -

    ReplyDelete
  2. Hi there! I could have sworn I've been to this site before
    but after reading through some of the post I realized
    it's new to me. Anyways, I'm definitely happy I found it and I'll be book-marking and checking
    back often!

    Have a look at my webpage :: Minecraft Pocket Edition free

    ReplyDelete
  3. It's а pity you ԁon't have a donate button! I'd most certainly donate to this brilliant blog!
    I suppose for now i'll settle for bookmarking and adding your RSS feed to mmy
    Google account. I look forward to new updates and will talk about this site
    with my Facebook ցroup. Talk ѕoon!

    Also vіsit my website pozycjonowanie stron ѡww poznań ()

    ReplyDelete
  4. Latest trend in mobile sports is multiplayer games that state bike race cheats similar promotion too.
    Many home theater system, got it home without incident and into bike race
    cheats your life. Onward, gaming industry, especially for their internet enabled in it.
    Even if you are going to be Travel Genius, Knight Lite, Sky Force,
    Open Transport and Meltdown. The fun an individual can get
    online information as a better way as it is a straightforward process.

    ReplyDelete
  5. You are so awesome! I do not believe I've truly read something like this
    before. So good to discover another person with
    a few original thoughts on this topic. Seriously..
    thank you for starting this up. This website is something that's needed
    on the web, someone with some originality!

    Also visit my web-site :: installing engineered antique wood flooring installation prices - ,

    ReplyDelete
  6. This piece of writing is actually a pleasant one it helps new web visitors, who are wishing for blogging.


    my website :: Ντετέκτιβ Αθήνα

    ReplyDelete
  7. Apart from all over the air minecraft pocket edition cheats and you have
    been successful in fulfilling the users' need. Through the
    children quickly become out-dated because new and better digital capabilities and graphics.
    So, what I am a supervisor. Moreover, mobile games.

    Businesses need to implement, in order to settle for the brilliant time breaking action,
    minecraft pocket edition cheats puzzle, sports or casino, all of these games from there.
    You have to incur expenses, it becomes very difficult to attract
    users quickly.

    Feel free to visit my web page - minecraft pocket edition hack and cheats

    ReplyDelete
  8. What a material of un-ambiguity and preserveness of precious know-how
    regarding unpredicted emotions.

    Feel free to visit my web-site - jasmin live

    ReplyDelete
  9. Great site you've got here.. It's difficult to find high-quality writing like yours nowadays.
    I really appreciate people like you! Take care!!


    my web-site :: webcam porno

    ReplyDelete
  10. Somebody necessarily help to make significantly posts I would state.
    This is the very first time I frequented your website page and to this point?

    I surprised with the analysis you made to create this particular submit extraordinary.
    Wonderful activity!

    Feel free to visit my blog post; http://s0b.eu/buydermanique30795

    ReplyDelete
  11. When you have your chimney cleaned after burning two cords ethanol fireplace flex
    fuel toronto of wood--however long that takes.

    ReplyDelete

Refer this site 2 ur frndz