
- Forum
- Programming Talk
- C and C++
- Counting paragraphs
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, ...
-
12-17-2007, 10:49 AM #1
- 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?

-
01-09-2008, 11:02 AM #2
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
-
01-09-2008, 12:11 PM #3
- 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

Reply With Quote





