summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/src/iostream.cpp
blob: 157c3977d478b2a255c7121d11c17b1fa3066b89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//===------------------------ iostream.cpp --------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "__std_stream"
#include "string"

_LIBCPP_BEGIN_NAMESPACE_STD

static __stdinbuf<char>  __cin(stdin);
static __stdoutbuf<char> __cout(stdout);
static __stdoutbuf<char> __cerr(stderr);
static __stdinbuf<wchar_t>  __wcin(stdin);
static __stdoutbuf<wchar_t> __wcout(stdout);
static __stdoutbuf<wchar_t> __wcerr(stderr);

istream cin(&__cin);
ostream cout(&__cout);
ostream cerr(&__cerr);
ostream clog(&__cerr);
wistream wcin(&__wcin);
wostream wcout(&__wcout);
wostream wcerr(&__wcerr);
wostream wclog(&__wcerr);

ios_base::Init __start_std_streams;

ios_base::Init::Init()
{
    cin.tie(&cout);
    _VSTD::unitbuf(cerr);
    cerr.tie(&cout);

    wcin.tie(&wcout);
    _VSTD::unitbuf(wcerr);
    wcerr.tie(&wcout);
}

ios_base::Init::~Init()
{
    cout.flush();
    clog.flush();

    wcout.flush();
    wclog.flush();
}

_LIBCPP_END_NAMESPACE_STD
OpenPOWER on IntegriCloud