std::basic_ostream::write – cppreference.com
Aus cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
||
Outputs characters from successive locations in the character array whose first element is pointed to by s. Characters are inserted into the output sequence until one of the following occurs:
- exactly
countcharacters are inserted - inserting into the output sequence fails (in which case
setstate(badbit)is called)
Diese Funktion ist eine unformatierte Ausgabe Funktion: es beginnt die Ausführung durch den Bau ein Objekt vom Typ sentry, die spült die tie()'d Ausgabepuffer wenn nötig und die Stream-Fehler überprüft. Nach dem Bau, wenn die Wache Objekt kehrt false, gibt die Funktion ohne zu versuchen, keine Ausgabe. Wenn eine Ausnahme während der Ausgabe ausgelöst wird, dann ios :: badbit gesetzt ist (die Ausnahme unterdrückt sofern exceptions()&badbit != 0, in welchem Fall es wird erneut ausgelöst)
Original:
This function is an unformatted output function: it begin execution by constructing an object of type sentry, which flushes the tie()'d output buffers if necessary and checks the stream errors. After construction, if the sentry object returns false, the function returns without attempting any output. If an exception is thrown during output, then ios::badbit is set (the exception is suppressed unless exceptions()&badbit != 0, in which case it is rethrown)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Parameter
| s | - | pointer to the character string to write |
| count | - | number of characters to write |
Rückgabewert
*this
Notes
Also, unlike the formatted output functions, this function does not set the failbit on failure.
Ausnahmen
If an exception occurs during output and exceptions()&badbit != 0, rethrows that exception.
If output fails and exceptions()&badbit != 0, throws ios_base::failure.
Beispiel
This function may be used to output object representations, i.e. binary output
#include <iostream> int main() { int n = 0x41424344; std::cout.write(reinterpret_cast<char*>(&n), sizeof n); std::cout << '\n'; }
Output:
Siehe auch
Einsätze Zeichendaten Original: inserts character data The text has been machine-translated via Google Translate. (Funktion) [edit] | |
fügt ein Zeichen Original: inserts a character The text has been machine-translated via Google Translate. (öffentliche Elementfunktion) [edit] | |