Ok, using gcc 3.2 I have some strange behavior when the user enters ^Z(26) as the dos eof marker. It seems that standard output wants to eat a line for no reason. This only happens when both cin and cout are directed to the console. This is using the command.com from windows 98 (under 98) Example:
Code:
#include<iostream>
#include<string>
int main(int argc, char *argv[]) {
std::string line;
char ch;
while(std::cin.get(ch)) line += ch;
std::cout << "Begin echo:" << std::endl; // this line will be eaten
std::cout << '(' << line << ')' << std::endl;
return 0;
}
In this case "Begin echo:" is never seen. If that line is removed then stdout eats the first line in the string 'line'. In other words everything up to the first \n is ignored, regardless of source. Agressive flushing of buffers does not help.