1 //===------------------------ iostream.cpp --------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "__std_stream" 11 #include "string" 12 13 _LIBCPP_BEGIN_NAMESPACE_STD 14 15 static __stdinbuf<char> __cin(stdin); 16 static __stdoutbuf<char> __cout(stdout); 17 static __stdoutbuf<char> __cerr(stderr); 18 static __stdinbuf<wchar_t> __wcin(stdin); 19 static __stdoutbuf<wchar_t> __wcout(stdout); 20 static __stdoutbuf<wchar_t> __wcerr(stderr); 21 22 istream cin(&__cin); 23 ostream cout(&__cout); 24 ostream cerr(&__cerr); 25 ostream clog(&__cerr); 26 wistream wcin(&__wcin); 27 wostream wcout(&__wcout); 28 wostream wcerr(&__wcerr); 29 wostream wclog(&__wcerr); 30 31 ios_base::Init __start_std_streams; 32 33 ios_base::Init::Init() 34 { 35 cin.tie(&cout); 36 _VSTD::unitbuf(cerr); 37 cerr.tie(&cout); 38 39 wcin.tie(&wcout); 40 _VSTD::unitbuf(wcerr); 41 wcerr.tie(&wcout); 42 } 43 44 ios_base::Init::~Init() 45 { 46 cout.flush(); 47 clog.flush(); 48 49 wcout.flush(); 50 wclog.flush(); 51 } 52 53 _LIBCPP_END_NAMESPACE_STD 54