From a60cc4d969bb024b2e81f1348690c827aa0c61e0 Mon Sep 17 00:00:00 2001 From: paolo Date: Tue, 15 Apr 2003 22:38:47 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65665 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 
-- 2.11.0