std::cin, std::wcin
Aus cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <iostream>
|
||
extern std::istream cin; |
(1) | |
extern std::wistream wcin; |
(2) | |
Die globale Objekte std::cin und std::wcin Steuereingang aus einem Stream Puffer Umsetzung Typs (abgeleitet von std::streambuf), mit der Standard-C-Input-Stream stdin assoziiert .
Original:
The global objects std::cin and std::wcin control input from a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C input stream stdin.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Diese Objekte sind garantiert gebaut, bevor die erste Konstruktor einer statischen Objekt aufgerufen werden, und sie werden garantiert, um die letzten Destruktor eines statischen Objekts überleben, so dass es immer möglich ist, von std::cin im User-Code zu lesen .
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 read from std::cin 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.
You can help to correct and verify the translation. Click here for instructions.
Sofern sync_with_stdio(false) ausgestellt wurde, ist es sicher den gleichzeitigen Zugriff auf diese Objekte aus mehreren Threads sowohl für formatierte und unformatierte Eingabe .
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 input.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sobald std::cin aufgebaut ist, kehrt std::cin.tie() &std::cout, und ebenfalls, std::wcin.tie() kehrt &std::wcout. Dies bedeutet, dass jede formatierte Eingabe Betrieb auf std::cin einen Anruf zwingt std::cout.flush(), wenn alle Zeichen für den Ausgang anstehen .
Original:
Once std::cin is constructed, std::cin.tie() returns &std::cout, and likewise, std::wcin.tie() returns &std::wcout. This means that any formatted input operation on std::cin forces a call to std::cout.flush() if any characters are pending for output.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Beispiel
Output:
Enter n: 10 f.n is 10
[Bearbeiten] Siehe auch
}} initialisiert Standard-Stream-Objekten 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. (öffentlichen Member der Klasse of std::ios_base )
| |
schreibt in den Standard-C Ausgabe-Stream stdout (globales Objekt) |