std::ios_base::sync_with_stdio
![]() | Эта страница была переведена автоматически с английской версии вики используя Переводчик Google. Перевод может содержать ошибки и странные формулировки. Наведите курсор на текст, чтобы увидеть оригинал. Щёлкните здесь, чтобы увидеть английскую версию этой страницы. (Вы можете помочь в исправлении ошибок и улучшении перевода. Для инструкций перейдите по ссылке.) |
staticbool sync_with_stdio(bool sync =true); | ||
Sets whether the standard std::cin, std::cout, std::cerr, std::clog, std::wcin, std::wcout, std::wcerr and std::wclog C++ streams are synchronized to the standard stdin, stdout, stderr and stdlog C streams after each input/output operation.
For a standard stream str
, synchronized with the C stream f
, the following pairs of functions have identical effect:
If the synchronization is turned off, the C++ standard streams are allowed to buffer their I/O independently, which may be considerably faster in some cases.
By default, all eight standard C++ streams are synchronized with their respective C streams.
It is implementation-defined if this function has any effect if called after some I/O occurred on the standard stream.
Содержание |
[править]Параметры
sync | — | the new synchronization setting |
[править]Возвращаемое значение
synchronization state before the call to the function
[править]Пример
#include <iostream>#include <cstdio>int main(){std::cout.sync_with_stdio(false);std::cout<<"a\n";std::printf("b\n");std::cout<<"c\n";}
Вывод:
b a c
[править]См. также
пишет в стандартный выходной поток C stdout (глобальный объект) | |
пишет в стандартный поток ошибок C stderr, небуферизирована (глобальный объект) | |
пишет в стандартный поток ошибок C stderr (глобальный объект) |