C code not working
I am dealing with code from The C Programming Language, and can't figure out why it's not working. I believe the program is supposed to count how many characters are in a text stream typed, but whenever you type something, it doesn't output anything. I am running Windows XP, using Dev-C++. Here is the code:
Does anyone have any ideas of how to fix my code, or what is going wrong? I have tried all my ideas.
nc = 0;
while (getchar() != EOF)
It won't output anything until it reads EOF. That means you can either run the program, type some junk and then press CTRL-D (or CTRL-Z in Windows), or you can run it like nc < file.txt.
itsme@itsme:~/C$ cat file.txt
itsme@itsme:~/C$ ./nc < file.txt