Possible Duplicate:
C : How to simulate an EOF?
I am currently trying to get use to C programming language. I have learnt java, so I am a bit familiar with the code style and all, but obviously there are differences.
This is the code that I currently have. It is from textbook, so I am assuming there is nothing wrong with the code.
#include <stdio.h>
int main(void)
{
long numberOfCharacter;
numberOfCharacter = 0;
while(getchar() != EOF)
{
++numberOfCharacter;
}
printf("%1d\n", numberOfCharacter);
}
I think that I have to trigger EOF in order to get the output that I want. I saw some other posts and they said to press Ctrl+Z to trigger the EOF, and I've tried but it doesn't work. I am assuming because it is Netbeans. So, the question is how do you trigger EOF in Netbeans?