Hey,

I'm reading "The C Programming Language" and making sure I experiment with every program example there is in it.
In the beggining I've come across one that's supposed to count the characters in the input.
When I try to write and run it myself, it doesn't print what it is supposed to and apparently it is looping on the 'while' part and I suspect it is because of the EOF test.

Here's the code, please, someone help me!

PS.: I'm using NetBeans IDE/Cygwin

Code:
#include <stdio.h>
#include <stdlib.h>


/* Counts characters in input 
 */

int main(int argc, char** argv) {
    
    long nc;
    
    nc = 0;
    while(getchar() != EOF){
        nc++;
    }
    printf("%d\n", nc);


    return (EXIT_SUCCESS);
}