Пространства имён
Варианты
Действия

std::cout, std::wcout

Материал из cppreference.com
< cpp | io

 
 
Библиотеки ввода / вывода
I / O манипуляторов
C-стиль I / O
Буферы
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(устарело)
Потоки
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Абстракций
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Файл I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
Струнный I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Массив I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(устарело)
ostrstream(устарело)
strstream(устарело)
Типы
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Интерфейс Ошибка категории
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_ostream
Глобальные объекты
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cout
wcout
Член функций
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::basic_ostream
basic_ostream::~basic_ostream
basic_ostream::operator=(C++11)
Форматированный ввод
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::operator<<
Неформатированная вход
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::put
basic_ostream::write
Позиционирование
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::tellp
basic_ostream::seekp
Разное
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::flush
basic_ostream::swap(C++11)
Член классов
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::sentry
Не являющиеся членами функций
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator<<(std::basic_ostream)
 
Заголовочный файл <iostream>
extern std::ostream cout;
(1)
extern std::wostream wcout;
(2)
Глобальные объекты std::cout и std::wcout выход управления в поток буфера реализации определенного типа (производное от std::streambuf), связанные с стандартный выходной поток C stdout.
Original:
The global objects std::cout and std::wcout control output to a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C output stream stdout.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Эти объекты гарантированно будут построены до первого конструктора статического объекта вызывается и они гарантированно пережить последний деструктор статического объекта, так что всегда можно написать std::cout в пользовательском коде.
Original:
These objects are guaranteed to be constructed before the first constructor of a static object is called and they are guaranteed to outlive the last destructor of a static object, so that it is always possible to write to std::cout in user code.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Если sync_with_stdio(false) было выдано, что это безопасно для одновременного доступа к этим объектам из нескольких потоков для форматированных и неформатированных выход.
Original:
Unless sync_with_stdio(false) has been issued, it is safe to concurrently access these objects from multiple threads for both formatted and unformatted output.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
После инициализации std::cout является галстук () 'д до std::cin и std::wcout в галстуке ()' д до std::wcin, это означает, что любые операции ввода на std::cin выполняет std::cout.flush() (с помощью конструктора std::basic_istream::sentry автора).
Original:
Once initialized, std::cout is tie()'d to std::cin and std::wcout is tie()'d to std::wcin, meaning that any input operation on std::cin executes std::cout.flush() (via std::basic_istream::sentry's constructor).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
После инициализации std::cout также связать () 'д до std::cerr и std::wcout является галстук ()' д до std::wcerr, это означает, что любые операции вывода на std::cerr выполняет std::cout.flush() (с помощью конструктора std::basic_ostream::sentry в) (начиная с C++11)
Original:
Once initialized, std::cout is also tie()'d to std::cerr and std::wcout is tie()'d to std::wcerr,, meaning that any output operation on std::cerr executes std::cout.flush() (via std::basic_ostream::sentry's constructor) (начиная с C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Пример

#include <iostream>
struct Foo {
    int n;
    Foo() {
       std::cout << "static constructor\n";
    }
    ~Foo() {
       std::cout << "static destructor\n";
    }
};
Foo f; // static object
int main()
{
    std::cout << "main function\n";
}

Вывод:

static constructor
main function
static destructor

[править] См. также

инициализирует стандартные объекты потока
Original:
initializes standard stream objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(public член класса std::ios_base) [edit]
пишет в стандартный поток ошибок stderr
(глобальный объект) C
Original:
writes to the standard C error stream stderr
(глобальный объект)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]
cout
wcout
пишет в стандартный выходной поток stdout
(глобальный объект) C
Original:
writes to the standard C output stream stdout
(глобальный объект)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]