The application I am working has to create files and in the final line of the file it has to include the number of the lines in the file. All simple enough and it did exactly what it was supposed to do.
However when I came to check the results manually I used the unix 'wc' command and this gave me a row count 1 less than what I was expecting and what the footer said was in the file. Strange.
I edited the file with 'vim' and low & behold wc was incorrect - what is going on ?
I then edited the file with hexEdit and noticed there was no CR & LF on the last line. Adding these made wc give the correct count.