blob: 157c3977d478b2a255c7121d11c17b1fa3066b89 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===------------------------ iostream.cpp --------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10#include "__std_stream"
11#include "string"
12
13_LIBCPP_BEGIN_NAMESPACE_STD
14
15static __stdinbuf<char> __cin(stdin);
16static __stdoutbuf<char> __cout(stdout);
17static __stdoutbuf<char> __cerr(stderr);
18static __stdinbuf<wchar_t> __wcin(stdin);
19static __stdoutbuf<wchar_t> __wcout(stdout);
20static __stdoutbuf<wchar_t> __wcerr(stderr);
21
22istream cin(&__cin);
23ostream cout(&__cout);
24ostream cerr(&__cerr);
25ostream clog(&__cerr);
26wistream wcin(&__wcin);
27wostream wcout(&__wcout);
28wostream wcerr(&__wcerr);
29wostream wclog(&__wcerr);
30
31ios_base::Init __start_std_streams;
32
33ios_base::Init::Init()
34{
35 cin.tie(&cout);
Howard Hinnant0949eed2011-06-30 21:18:19 +000036 _VSTD::unitbuf(cerr);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000037 cerr.tie(&cout);
38
39 wcin.tie(&wcout);
Howard Hinnant0949eed2011-06-30 21:18:19 +000040 _VSTD::unitbuf(wcerr);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000041 wcerr.tie(&wcout);
42}
43
44ios_base::Init::~Init()
45{
46 cout.flush();
47 clog.flush();
48
49 wcout.flush();
50 wclog.flush();
51}
52
53_LIBCPP_END_NAMESPACE_STD