148104Syokota// Copyright (C) 2003, 2009 Free Software Foundation, Inc. 248104Syokota// 348104Syokota// This file is part of the GNU ISO C++ Library. This library is free 448104Syokota// software; you can redistribute it and/or modify it under the 548104Syokota// terms of the GNU General Public License as published by the 648104Syokota// Free Software Foundation; either version 3, or (at your option) 748104Syokota// any later version. 848104Syokota 948104Syokota// This library is distributed in the hope that it will be useful, 1048104Syokota// but WITHOUT ANY WARRANTY; without even the implied warranty of 1148104Syokota// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1248104Syokota// GNU General Public License for more details. 1348104Syokota 1448104Syokota// You should have received a copy of the GNU General Public License along 1548104Syokota// with this library; see the file COPYING3. If not see 1648104Syokota// <http://www.gnu.org/licenses/>. 1748104Syokota 1848104Syokota// 27.8.1.4 Overridden virtual functions 1948104Syokota 2048104Syokota#include <fstream> 2148104Syokota#include <testsuite_hooks.h> 2248104Syokota 2348104Syokotaconst char name[] = "tmp_12232"; 2448104Syokota 2548104Syokota// libstdc++/12232 2648104Syokotavoid test01() 2748104Syokota{ 2848104Syokota using namespace std; 2948667Syokota bool test __attribute__((unused)) = true; 3048104Syokota 3148104Syokota filebuf fbout; 3248104Syokota fbout.open(name, ios_base::out); 3348104Syokota fbout.sputn("abc", 3); 3448104Syokota 3548104Syokota streampos p1 = fbout.pubseekoff(0, ios_base::cur, ios_base::in); 3648104Syokota VERIFY( p1 != streampos(-1) ); 3748104Syokota fbout.sputn("de", 2); 3848104Syokota 3948104Syokota streampos p2 = fbout.pubseekpos(p1, ios_base::openmode()); 4048104Syokota VERIFY( p2 != streampos(-1) ); 4148104Syokota fbout.sputn("34", 2); 4248104Syokota 4348104Syokota streampos p3 = fbout.pubseekoff(0, ios_base::beg, ios_base::ate); 4448104Syokota VERIFY( p3 != streampos(-1) ); 4548104Syokota fbout.sputn("012", 3); 4648104Syokota 4748104Syokota fbout.close(); 4848104Syokota 4948104Syokota filebuf fbin; 5048104Syokota fbin.open(name, ios_base::in); 5148104Syokota 5248104Syokota streampos p4 = fbin.pubseekoff(0, ios_base::beg, ios_base::ate); 5348104Syokota VERIFY( p4 != streampos(-1) ); 5448104Syokota VERIFY( fbin.sgetc() == '0' ); 5548104Syokota 5648104Syokota streampos p5 = fbin.pubseekoff(-1, ios_base::end, ios_base::out); 5748104Syokota VERIFY( p5 != streampos(-1) ); 5848104Syokota VERIFY( fbin.sbumpc() == '4' ); 5948104Syokota 6048104Syokota streampos p6 = fbin.pubseekpos(p4, ios_base::binary); 6148104Syokota VERIFY( p6 != streampos(-1) ); 6248104Syokota VERIFY( fbin.sbumpc() == '0' ); 6348104Syokota 6448104Syokota fbin.close(); 6548104Syokota} 6648104Syokota 6748104Syokotaint main() 6848104Syokota{ 6948104Syokota void test01(); 7048104Syokota return 0; 7148667Syokota} 7248104Syokota