From bafa3c3c06c25c6e6a7452675e3ddf6a393368d7 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Tue, 15 Apr 2003 22:38:47 +0000 Subject: re PR libstdc++/9423 (filebuf::pubsetbuf(0, 0) doesn't turn off buffering if called after open) 2003-04-15 Benjamin Kosnik Paolo Carlini 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. Co-Authored-By: Paolo Carlini From-SVN: r65665 --- libstdc++-v3/docs/html/27_io/howto.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libstdc++-v3/docs/html') diff --git a/libstdc++-v3/docs/html/27_io/howto.html b/libstdc++-v3/docs/html/27_io/howto.html index c8538a6..5cf4f4f 100644 --- a/libstdc++-v3/docs/html/27_io/howto.html +++ b/libstdc++-v3/docs/html/27_io/howto.html @@ -159,15 +159,18 @@ 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 before any I/O operations at - all have been done, i.e., as soon as possible after opening: + all have been done (note that opening counts as an I/O operation):

-   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 
-- cgit v1.1