Debian Codegraph @

yo/concrete/examples/fdinseek.cc

raw
1 #include "fdinseek.h"
2 #include <string>
3 #include <iostream>
4 #include <istream>
5 #include <iomanip>
6 using namespace std;
7
8 int main()
9 {
10 IFdSeek fds(0);
11 istream is(&fds);
12 string s;
13
14 while (true)
15 {
16 if (!getline(is, s))
17 break;
18
19 streampos pos = is.tellg();
20
21 cout << setw(5) << pos << ": `" << s << "'\n";
22
23 if (!getline(is, s))
24 break;
25
26 streampos pos2 = is.tellg();
27
28 cout << setw(5) << pos2 << ": `" << s << "'\n";
29
30 if (!is.seekg(pos))
31 {
32 cout << "Seek failed\n";
33 break;
34 }
35 }
36 }