FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb77.C
blob3db45cc80079bc5e7a80c00f4c7eeeec9198b1e4
1 #include <iostream>
2 #include <sstream>
4 using namespace std;
6 int
7 main(int, char* [])
9   stringstream s;
11   s << "line 1\nline 2\n\nline 4";
12   s << std::ends;
14   int nLine = 0;
16   while( true ) {
17     char line[100];
18     s.get(line, 100);
20     if( ! line ) {
21       break;
22     }
24     ++nLine;
25     std::cout << nLine << ": " << line << std::endl;
27     if( nLine > 10 ) {  // stop infinite loop
28       break;
29     }
30   }
31   return 0;