+2003-04-15 Benjamin Kosnik <bkoz at redhat dot com>
+ Paolo Carlini <pcarlini at unitus dot it>
+
+ PR libstdc++/9423
+ * docs/html/27_io/howto.html
+ ('The buffering is screwing up my program!'): Explain that
+ opening counts as an I/O operation.
+
2003-04-15 Andreas Tobler <a.tobler@schweiz.ch>
* testsuite/thread/pthread1.cc: Enable for darwin test.
because the data needs to appear quickly (a prime example is a
log file for security-related information). The way to do this is
just to turn off the buffering <em>before any I/O operations at
- all</em> have been done, i.e., as soon as possible after opening:
+ all</em> have been done (note that opening counts as an I/O operation):
</p>
<pre>
- std::ofstream os ("/foo/bar/baz");
- std::ifstream is ("/qux/quux/quuux");
+ std::ofstream os;
+ std::ifstream is;
int i;
os.rdbuf()->pubsetbuf(0,0);
is.rdbuf()->pubsetbuf(0,0);
+
+ os.open("/foo/bar/baz");
+ is.open("/qux/quux/quuux");
...
os << "this data is written immediately\n";
is >> i; // and this will probably cause a disk read </pre>