Debian Codegraph @

libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc

raw
1 // 1999-07-28 bkoz
2
3 // Copyright (C) 1999-2025 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
19
20 // C++98 27.6.1.2.3 basic_istream::operator>>
21
22 // { dg-require-fileio "" }
23 // { dg-additional-files "istream_extractor_other-1.tst" }
24 // { dg-additional-files "istream_extractor_other-1.txt" }
25 // { dg-additional-files "istream_extractor_other-2.tst" }
26 // { dg-final { file-io-diff "istream_extractor_other-1" } }
27 // { dg-final { file-io-diff "istream_extractor_other-2" } }
28
29 #include <istream>
30 #include <fstream>
31 #include <testsuite_hooks.h>
32
33 // filebufs.
34 void test02()
35 {
36 const char name_01[] = "istream_extractor_other-1.txt"; //read
37 const char name_02[] = "istream_extractor_other-2.txt"; //write
38
39 std::filebuf fbin, fbout;
40 fbin.open(name_01, std::ios_base::in);
41 fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
42 VERIFY( fbin.is_open() );
43 VERIFY( fbout.is_open() );
44
45 {
46 std::istream is(&fbin);
47 is.unsetf(std::ios_base::skipws);
48 is >> &fbout;
49 }
50
51 fbout.close();
52 fbin.close();
53 VERIFY( !fbin.is_open() );
54 VERIFY( !fbout.is_open() );
55 }
56
57 int main()
58 {
59 test02();
60 return 0;
61 }