1// 1999-05-21 bkoz 2// 2000-05-21 Benjamin Kosnik <bkoz@redhat.com> 3// 2001-01-17 Loren J. Rittle <ljrittle@acm.org> 4 5// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 6// Free Software Foundation 7// 8// This file is part of the GNU ISO C++ Library. This library is free 9// software; you can redistribute it and/or modify it under the 10// terms of the GNU General Public License as published by the 11// Free Software Foundation; either version 3, or (at your option) 12// any later version. 13 14// This library is distributed in the hope that it will be useful, 15// but WITHOUT ANY WARRANTY; without even the implied warranty of 16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17// GNU General Public License for more details. 18 19// You should have received a copy of the GNU General Public License along 20// with this library; see the file COPYING3. If not see 21// <http://www.gnu.org/licenses/>. 22 23// 27.4.2.4 ios_base static members 24// @require@ %-*.tst 25// @diff@ %-*.tst %-*.txt 26 27// This test fails on platforms using a wrapper, because this test 28// redirects stdout to a file and so the exit status printed by the 29// wrapper is not visibile to DejaGNU. DejaGNU then assumes that the 30// test exited with a non-zero exit status. 31// { dg-do run { xfail { ! unwrapped } } } 32 33#include <cstdio> 34#include <sstream> 35#include <iostream> 36#include <testsuite_hooks.h> 37 38// N.B. Once we have called sync_with_stdio(false), we can never go back. 39 40void 41test01() 42{ 43 std::ios_base::sync_with_stdio(); 44 std::freopen("ios_base_members_static-1.txt", "w", stderr); 45 46 for (int i = 0; i < 2; i++) 47 { 48 std::fprintf(stderr, "1"); 49 std::cerr << "2"; 50 std::putc('3', stderr); 51 std::cerr << '4'; 52 std::fputs("5", stderr); 53 std::cerr << 6; 54 std::putc('7', stderr); 55 std::cerr << 8 << '9'; 56 std::fprintf(stderr, "0\n"); 57 } 58} 59 60int main(void) 61{ 62 test01(); 63 return 0; 64} 65