You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/02/03 00:05:06 UTC
[jira] Commented: (STDCXX-333) std::wfilebuf extracts more than 1
character from a 1 byte file
[ https://issues.apache.org/jira/browse/STDCXX-333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469901 ]
Martin Sebor commented on STDCXX-333:
-------------------------------------
How odd. I can reproduce this but only intermittently and with different results:
$ while [ $? -eq 0 ]; do ./t; done; true; while [ $? -eq 0 ]; do ./t; done
97 -1
97 -1
97 -1
97 -1
97 8
t: t.cpp:21: int main(): Assertion `std::wfilebuf::traits_type::eof () == c [1]' failed.
Aborted
97 -1
97 -1
97 -1
97 -1
97 -1
97 -1
97 104
: t.cpp:21: int main(): Assertion `std::wfilebuf::traits_type::eof () == c [1]' failed.
Aborted
> std::wfilebuf extracts more than 1 character from a 1 byte file
> ---------------------------------------------------------------
>
> Key: STDCXX-333
> URL: https://issues.apache.org/jira/browse/STDCXX-333
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 27. Input/Output
> Affects Versions: 4.1.3
> Environment: gcc 3.2.3 on Linux
> Reporter: Mark Brown
>
> I get an an abort when I run the following program on Linux.
> #include <cassert>
> #include <fstream>
> #include <iostream>
> int main ()
> {
> {
> std::filebuf fb;
> fb.open ("file", std::ios::out);
> fb.sputc ('a');
> }
> std::wfilebuf fb;
> fb.pubimbue (std::locale ("en_US.UTF-8"));
> fb.open ("file", std::ios::in);
> const int c[] = { fb.sbumpc (), fb.sgetc () };
> std::cout << c [0] << ' ' << c [1] << std::endl;
> assert (L'a' == c [0]);
> assert (std::wfilebuf::traits_type::eof () == c [1]);
> }
> test: test.cpp:21: int main(): Assertion `std::wfilebuf::traits_type::eof () == c [1]' failed.
> Aborted
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.