Site contents and design © Brian Beckett 2008
Contact: brian {at} worthlesscheese {dot} com

Valid HTML 4.01 Strict

Valid CSS!

Wordcount - a C++ tool project

Description

It's just what it sounds like. A program to count the number of words in a file. Wordcount also counts the number of lines in the file supplied, the number of characters and the number of characters without counting whitespace. It can either output all the counts or just a single one, suitable for pipelining.

Raison d'être

A simple reason for this one - Windows XP doesn't appear to have a command line wordcount program! Having spent three years at University using Linux, I got rather used to using the command line along with all of its tools. Being able to count the words in a file is a useful ability, so Wordcount was born.

It's also worth nothing that this program was written in C++. I don't really know C++ very well at the time of writing, so this program was something of a learning exercise.

Development Plans

None. The program is finished, as far as I can forsee. It's Wordcount - what else is there to do? Add a mail client??

Development History

May 2007 - I wrote a simple program to count the number of words in a file. I think I was working through a website called something like "The C++ Challenge"?
January 2008 - I decided to upgrade the program to count more than just words. Having made the program count words, lines and characters (including and not including whitespace) I hit a snag.
25 June 2008 - I remembered that this project needed finishing, so dug out my (neglected) C++ book. Having (re?)discovered how C-Strings work, I was able to process the command line arguments and finish the program.
26 June 2008, 1 am - I decided to write this page rather than go to bed.

System Requirements

Windows XP. The program should work on other systems too. The source code is available, so feel free to compile it for whatever system you want.

Downloads

Windows executable

Source code (This is a plain text file - you can open it in Notepad)

Instructions

Compiling

Running

The program is designed to run from the command line. If you have placed the executable in your path variable (You might want to check out my guide about setting your environmental variables.) then you can just type `wc filename' at any command prompt. If you haven't, then you need to use the full path to the executable and/or the file.
If you run `wc -h' then a help screen will be displayed. This explains the available options, e.g. only display number of words.

Licence

I don't currently have a specific licence in mind at the moment. However, the conditions I want you to abide by are these: Finally, if you have done something cool with the source code, or just found the program useful, please let me know! I would love to hear from you! Contact brian {at} worthlesscheese {dot} com