]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_ostream/seekp/char/2346-fstream.cc
3 // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 // 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // 27.6.2.4 basic_ostream seek members [lib.ostream.seeks]
23 // @require@ %-*.tst %-*.txt
24 // @diff@ %-*.tst %-*.txt
26 // { dg-require-fileio "" }
32 #include <testsuite_hooks.h>
34 const char* s
= " lootpack, peanut butter wolf, rob swift, madlib, quasimoto";
37 void write_rewind(std::iostream
& stream
)
39 bool test
__attribute__((unused
)) = true;
41 for (int j
= 0; j
< times
; j
++)
43 std::streampos begin
= stream
.tellp();
45 for (int i
= 0; i
< times
; ++i
)
46 stream
<< j
<< '-' << i
<< s
<< '\n';
50 VERIFY( stream
.good() );
53 void check_contents(std::iostream
& stream
)
55 bool test
__attribute__((unused
)) = true;
58 stream
.seekg(0, std::ios::beg
);
60 int loop
= times
* times
+ 2;
63 stream
.ignore(80, '\n');
77 ofstrm
.open("istream_seeks-3.txt", std::ios::out
);
84 ifstrm
.open("istream_seeks-3.txt", std::ios::in
);
85 check_contents(ifstrm
);