![]() |
| ||
| while(true) loop + getline() = infinite loop?? Dear all, Forgive me for posting two threads for the same problem. I was not showing my problem clearly enough in the previous one. Thank Narue for answering that anyway. Now I do it again here: #include <iostream> This programme runs fine when I compile and click the executable. But things go wrong if I do it in command-line and redirect the input stream to a text file: $a.out < inputFile *The programme does not let me do any input and it loops again and again instead.* I guest this is a problem associated with getline() function. So what do you think about this? Jim |
| ||
| Re: while(true) loop + getline() = infinite loop?? Quote:
Or do you mean to redirect the output to a file? $a.out > inputFile |
| ||
| Re: while(true) loop + getline() = infinite loop?? Quote:
Hi Dave, Oh sorry for my grammer. I actually mean input from: $a.out < inputFile Here is what the content of inputFile maybe: ls The problem occur when the programme has read all the way to the last line: quit The programme loops and does not ask me for input. Jim |
| All times are GMT -4. The time now is 2:24 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC