summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2002-11-11 23:18:05 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2002-11-11 23:18:05 +0000
commit6eeb7d7ae07a0534f9bf07f0bb146d941f4b0731 (patch)
treeb453888a589082dd78db7efe37b82197810bdf37 /libstdc++-v3/include/bits
parent90e76e864a228ac5cb306aa33f5716913fab061a (diff)
downloadgcc-6eeb7d7ae07a0534f9bf07f0bb146d941f4b0731.tar.gz
re PR libstdc++/6746 (ifstream::readsome() always returns zero)
2002-11-11 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/6746 * include/bits/fstream.tcc (filebuf::open): Set input pointers. * config/io/basic_file_stdio.cc (__basic_file::_M_open_mode): Set __p_mode as well. (__basic_file::open): Set to non-block for input. * testsuite/27_io/istream_unformatted.cc (test12): Add. (test13): Same. From-SVN: r59030
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc10
1 files changed, 10 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index 66cb9a1b179..387f099ae98 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -90,11 +90,21 @@ namespace std
{
_M_allocate_internal_buffer();
_M_mode = __mode;
+
+ // Setup initial position of buffer.
_M_set_indeterminate();
+ // Set input buffer to something real.
+ // NB: Must open in non-blocking way to do this, or must
+ // set the initial position in a different manner than
+ // using underflow.
+ if (__mode & ios_base::in && _M_buf_allocated)
+ this->underflow();
+
if ((__mode & ios_base::ate)
&& this->seekoff(0, ios_base::end, __mode) < 0)
this->close();
+
__ret = this;
}
}