repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
FSF GCC merge 02/23/03
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.robertl
/
eb77.C
blob
3db45cc80079bc5e7a80c00f4c7eeeec9198b1e4
1
#include <iostream>
2
#include <sstream>
3
4
using namespace std;
5
6
int
7
main(int, char* [])
8
{
9
stringstream s;
10
11
s << "line 1\nline 2\n\nline 4";
12
s << std::ends;
13
14
int nLine = 0;
15
16
while( true ) {
17
char line[100];
18
s.get(line, 100);
19
20
if( ! line ) {
21
break;
22
}
23
24
++nLine;
25
std::cout << nLine << ": " << line << std::endl;
26
27
if( nLine > 10 ) { // stop infinite loop
28
break;
29
}
30
}
31
return 0;
32
}