for example, my text file


how can i code a program to count total of line ?
thank you.

Recommended Answers

All 4 Replies

You posted in the Apple, IOS category..but you are asking about a program to count the lines in a text file. Can you elaborate on exactly what you are asking?

Also, are you working with a specific progamming/scripting language?

MS. It’s easy to tell that Microsoft’s scripting technologies weren’t written by people who do system administration for a living. Our scripting technologies are jam-packed with features and capabilities, yet we always seem to missing the things that people really want to do. Counting the number of lines in a text file is a good example of that. This seems to be something system administrators do on a regular basis; after all, this is the fourth or fifth time we’ve been asked this question just this month. And yet, there’s no straightforward way to count the number of lines in a text.

in which lang you want the coding..c or c++

In MacOS or Linux use
wc -l <filename>

In windows, I don't know of a command line tool. I just use notepad++ to check the file.

A google search will give you various scripts to do the same from cli.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.