[ 
https://issues.apache.org/jira/browse/STDCXX-161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Sebor closed STDCXX-161.
-------------------------------


Regression test committed in 
[r650356|http://svn.apache.org/viewvc?rev=650356&view=rev].

> filebuf::sgetn() fails after sputn() in stdio mode
> --------------------------------------------------
>
>                 Key: STDCXX-161
>                 URL: https://issues.apache.org/jira/browse/STDCXX-161
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.3
>         Environment: all
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>            Priority: Critical
>             Fix For: 4.1.4
>
>
> The program below fails at runtime (std::ios::stdio is an extension of this 
> implementation that forces the filebuf to use the stdio facilities for I/O 
> instead of OS native calls).
> $ cat t.cpp && gmake t && ./t
> #include <fstream>
> #include <cassert>
> int main ()
> {
>     std::filebuf fb;
>     assert (0 != fb.open ("testfile.text", std::ios::out));
>     assert (6 == fb.sputn ("ABCDEF", 6));
>     assert (0 != fb.close ());
>     assert (0 != fb.open ("testfile.text",
>                           std::ios::in | std::ios::out | std::ios::stdio));
>     assert (3 == fb.sputn ("abc", 3));
>     assert (-1 != fb.pubsync ());
>     char buf [3] = "";
>     assert (3 == fb.sgetn (buf, sizeof buf));
>     assert (0 == std::filebuf::traits_type::compare ("DEF", buf, 3));
> }
> aCC -c -I/build/sebor/dev/stdlib/include/ansi -I/usr/include  -D_RWSTDDEBUG   
> -mt -D_RWSTD_USE_CONFIG -I/build/sebor/aCC-3.63-15s/include 
> -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest 
> -I/build/sebor/dev/stdlib/../rwtest/include 
> -I/build/sebor/dev/stdlib/tests/include  -Aa +nostl  -g +d  +w +W392 +W655 
> +W684 +W818 +W819 +W849  t.cpp
> aCC t.o -o t -L/build/sebor/aCC-3.63-15s/rwtest -lrwtest15s -Aa +nostl -Wl,+s 
> -Wl,+vnocompatwarnings -L/build/sebor/aCC-3.63-15s/lib   -mt 
> -L/build/sebor/aCC-3.63-15s/lib -lstd15s   -lm
> Assertion failed: 0 == std::filebuf::traits_type::compare ("DEF", buf, 3), 
> file t.cpp, line 20
> ABORT instruction (core dumped)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to