]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_ostream/seekp/char/2346-fstream.cc
3 // Copyright (C) 2000-2013 Free Software Foundation, Inc.
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)
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.
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/>.
20 // 27.6.2.4 basic_ostream seek members [lib.ostream.seeks]
21 // @require@ %-*.tst %-*.txt
22 // @diff@ %-*.tst %-*.txt
24 // { dg-require-fileio "" }
30 #include <testsuite_hooks.h>
32 const char* s
= " lootpack, peanut butter wolf, rob swift, madlib, quasimoto";
35 void write_rewind(std::iostream
& stream
)
37 bool test
__attribute__((unused
)) = true;
39 for (int j
= 0; j
< times
; j
++)
41 std::streampos begin
= stream
.tellp();
43 for (int i
= 0; i
< times
; ++i
)
44 stream
<< j
<< '-' << i
<< s
<< '\n';
48 VERIFY( stream
.good() );
51 void check_contents(std::iostream
& stream
)
53 bool test
__attribute__((unused
)) = true;
56 stream
.seekg(0, std::ios::beg
);
58 int loop
= times
* times
+ 2;
61 stream
.ignore(80, '\n');
75 ofstrm
.open("istream_seeks-3.txt", std::ios::out
);
82 ifstrm
.open("istream_seeks-3.txt", std::ios::in
);
83 check_contents(ifstrm
);