Files
2025-10-25 03:02:53 +03:00

49 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[ios.members.static]
# 31 Input/output library [[input.output]](./#input.output)
## 31.5 Iostreams base classes [[iostreams.base]](iostreams.base#ios.members.static)
### 31.5.2 Class ios_base [[ios.base]](ios.base#ios.members.static)
#### 31.5.2.5 Static members [ios.members.static]
[🔗](#lib:sync_with_stdio,ios_base)
`static bool sync_with_stdio(bool sync = true);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L1369)
*Effects*: If any input or output operation has occurred using the standard streams prior to the
call, the effect isimplementation-defined[.](#1.sentence-1)
Otherwise, called with a false argument, it allows the standard streams to
operate independently of the standard C streams[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L1378)
*Returns*: true if the previous state of the [standard iostream objects](iostream.objects "31.4Standard iostream objects[iostream.objects]") was synchronized and otherwise returnsfalse[.](#2.sentence-1)
The first time it is called,
the function returnstrue[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L1388)
*Remarks*: When a standard iostream object str is*synchronized* with a standard stdio stream f, the effect of inserting a character c byfputc(f, c); is the same as the effect ofstr.rdbuf()->sputc(c); for any sequences of characters; the effect of extracting a character c byc = fgetc(f); is the same as the effect ofc = str.rdbuf()->sbumpc(); for any sequences of characters; and the effect of pushing back a character c byungetc(c, f); is the same as the effect ofstr.rdbuf()->sputbackc(c); for any sequence of characters[.](#3.sentence-1)[259](#footnote-259 "This implies that operations on a standard iostream object can be mixed arbitrarily with operations on the corresponding stdio stream. In practical terms, synchronization usually means that a standard iostream object and a standard stdio object share a buffer.")
[259)](#footnote-259)[259)](#footnoteref-259)
This implies that operations on a standard iostream object can be mixed arbitrarily
with operations on the corresponding stdio stream[.](#footnote-259.sentence-1)
In practical terms, synchronization
usually means that a standard iostream object and a standard stdio object share a
buffer[.](#footnote-259.sentence-2)