PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Counting words program and bitmaps...

How exactly would I do this? I know strnlen counts how many characters are in a string, but how could I count words? By recognizing the spaces?

Also, what is the most effective way of making graphics in console? I know the about the array business or whatever, but is there an easier way?
There's a word count utility in the linux core package, called wc. Go look at <a href="http://ftp.gnu.org/pub/gnu/coreutils/coreutils-5.0.tar.gz">its source</a> maybe (that's the source for the entire coreutils - it's not 5MB of wc source :)).

I had a quick look, and it's essentially a small finite state machine that increments the word count when a "word" is broken by whitespace.
So, dumping ("word count" finite state machine) into google yields:
<a href="http://216.239.41.104/search?q=cache:Oi5Ivjo8T8IJ:www.xor.co.uk/uwe/Lecture7.html+%22word+count%22+finite+state+machine&hl;=en&ie;=UTF-8">this</a> (which is more simplistic, but also more understandable).

Here endeth the lesson on searching :P

Not sure what you're asking for in the second paragraph.
I'll just use the way they counted numbers, make an if(" ") with a space. Maybe it will work.