Exforsys
+ Reply to Thread
Results 1 to 3 of 3

Counting paragraphs

This is a discussion on Counting paragraphs within the C and C++ forums, part of the Programming Talk category; I need to implement a function to count the number of paragraphs in a file. Can anybody help me please, ...

  1. #1
    scottdeedee is offline Junior Member Array
    Join Date
    Dec 2007
    Answers
    2

    Counting paragraphs

    I need to implement a function to count the number of paragraphs in a file. Can anybody help me please, because I cannot figure out how?


  2. #2
    tprabhuit's Avatar
    tprabhuit is offline Junior Member Array
    Join Date
    Dec 2007
    Location
    Coimbatore
    Answers
    15
    Hi,

    Read the file character-wise and count for the existsence of "\n".

    The total no. of "\n" is the no. of paragraphs.

    Regards,
    Prabhu.T


  3. #3
    scottdeedee is offline Junior Member Array
    Join Date
    Dec 2007
    Answers
    2
    Hi tprabhuit,

    Thanks for the reply. I figured out how to count the number of paragraphs. What I had to do was, as you said count the number of \n but not only. If you count the number of \n it will give you the number of lines not the number of paragraphs. You have to search for \n\n together not only \n
    Once again 10x for the reply
    Andrew


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...