4 // Copyright (C) 1999 Free Software Foundation
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 // 27.6.2.5.4 basic_ostream character inserters
31 const int size = 1000;
32 const char name_01[] = "testsuite/ostream_inserter_other-1.tst";
33 const char name_02[] = "testsuite/ostream_inserter_other-1.txt";
34 const char name_03[] = "testsuite/ostream_inserter_other-2.tst";
35 const char name_04[] = "testsuite/ostream_inserter_other-2.txt";
49 typedef std::ios_base::iostate iostate;
52 // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
54 std::ifstream f_in1(name_01);
55 std::ofstream f_out1(name_02);
56 std::stringbuf* strbuf01 = NULL;
57 iostate state01 = f_in1.rdstate();
59 iostate state02 = f_in1.rdstate();
60 test &= state01 != state02;
61 test &= (state02 & std::ios_base::failbit) != 0;
62 state01 = f_out1.rdstate();
64 state02 = f_out1.rdstate();
65 test &= state01 != state02;
66 test &= (state02 & std::ios_base::failbit) != 0;
69 std::ifstream f_in(name_01);
70 std::ofstream f_out(name_02);
71 f_out << f_in.rdbuf();
75 // filebuf->stringbuf->filebuf
76 std::ifstream f_in2(name_03);
77 std::ofstream f_out2(name_04); // should be different name
78 std::stringbuf strbuf02;
84 // no characters inserted