I am reading through "The C Programming Language", and working through all the exercises with CodeBlocks. But I cannot get my character counter to work, despite copying it directly from the book. The code looks like this:

```
#include <stdio.h>

main(){
    long nc;

    nc = 0;

    while (getchar() != EOF)
        ++nc;
    printf("%ld\n", nc);
}

```

When I run the program, it opens a window I can type in, but when I hit enter all that happens is it skips down a line and I can keep typing, but I think it's supposed to print the number of characters.

Any idea what's going wrong?