How to get the total number of lines of a text file

S

Skip

Mullin said:
How to get the total number of lines of a text file

Read it completely and count either "\n", "\r\n" or "\r" depending on the
platform the text-file was constructed.
 
T

Thomas Kellerer

Skip wrote on 12.06.2005 19:16:
Read it completely and count either "\n", "\r\n" or "\r" depending on the
platform the text-file was constructed.

If you use a BufferedReader then it will take care of the line endings
automatically.

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top