很经典的书籍
源代码在线查看: exercise16.cpp
//: C04:Exercise16.cpp
#include
#include
#include
#include "../require.h"
using namespace std;
#define d(a) cout
void tellPointers(fstream& s) {
d(s.tellp());
d(s.tellg());
cout }
void tellPointers(stringstream& s) {
d(s.tellp());
d(s.tellg());
cout }
int main() {
fstream in("Exercise16.cpp");
assure(in, "Exercise16.cpp");
in.seekg(10);
tellPointers(in);
in.seekp(20);
tellPointers(in);
stringstream memStream("Here is a sentence.");
memStream.seekg(10);
tellPointers(memStream);
memStream.seekp(5);
tellPointers(memStream);
} ///:~