I am trying to read from standard input ([a.out < text.txt] in unix), and I have used the following two blocks of code:
int main(){
while (!cin.eof()){ReadFunction()}
OutputFunction();}
and
int main(){
char c;
while (cin.getchar(c)){ReadFunction()}
OutputFunction();}
Both of these loops execute the read function correctly but neither of them exit the loop and execute the output function. How can I read in character by character from standard input and then execute my output function?