yo/concrete/streambuf/fdstreambuf/fdinbuf100.cc
raw| 1 | #include "fdstreambuf.h" |
| 2 | #include <string> |
| 3 | #include <iostream> |
| 4 | #include <istream> |
| 5 | |
| 6 | using namespace std; |
| 7 | |
| 8 | int main(int argc) |
| 9 | { |
| 10 | fdstreambuf |
| 11 | fds(0, 5, ios::in); |
| 12 | istream |
| 13 | is(&fds); |
| 14 | string |
| 15 | s; |
| 16 | |
| 17 | cout << "START\n"; |
| 18 | |
| 19 | for (size_t line = 0; getline(is, s); line++) |
| 20 | { |
| 21 | cout << s << '\n'; |
| 22 | if ((line & 3) == 0) |
| 23 | { |
| 24 | is.unget(); |
| 25 | is.unget(); |
| 26 | is.unget(); |
| 27 | is.unget(); |
| 28 | } |
| 29 | is.clear(); |
| 30 | } |
| 31 | } |