-
Help with redirection
Hi everyone, I have a problem where when I do a redirection, I keep getting an infinite loop. Is there a way I can read a data file until it ends, and that ends the program? Right now, this is just a snippet of the code that loops a cin statement to keep the program running. If I wanted to "a.out < inputfile", it will continue going unless exit is somewhere in the file. Is there a way I can just use a eof() thingy or something similar that will stop running the loop if the end of the data file is reached? THanks in advance for any help
Nornny
Code:
cin >> search;
while (search != "exit") {
dict.seek(search);
cin >> search;
}
-
Code:
while (cin >> search) {
dict.seek(search);
}
It reads until EOF.