Hmm, is wc supposed to behave that way?

When wc() is instructed to report a line count, it gives one line less than I expect when the last line doesn't end with a newline. Judging from the source, it seems to me like wc() simply counts newlines, which would explain why a last line not ending in a newline won't get the line counter incremented.

Is this a bug or is wc() supposed to behave like this?

Alphons
 
Back
Top