From bafa3c3c06c25c6e6a7452675e3ddf6a393368d7 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Tue, 15 Apr 2003 22:38:47 +0000 Subject: [PATCH] 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/ChangeLog | 8 ++++++++ libstdc++-v3/docs/html/27_io/howto.html | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2cd955819da..0f3232d4dde 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +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. + 2003-04-15 Andreas Tobler * testsuite/thread/pthread1.cc: Enable for darwin test. diff --git a/libstdc++-v3/docs/html/27_io/howto.html b/libstdc++-v3/docs/html/27_io/howto.html index c8538a6f639..5cf4f4f05ef 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