By using an if statement how could i get a character to detect end-of-file.

i was thinking something like this:

char a = '\0';
int count = 0;

if(a == EOF)

but it doesn't seem to detect the end-of-file. Any idea would be appreciated.



A character doesn't detect EOF. Reading the file detects EOF.

Based on what little you posted, that's about all we can say.

Maybe you are confusing EOF with end-of-string NULL terminators? The last character of a standard C or C++ string is '\0', which is called a NULL terminator.