std::basic_stringbuf::setbuf
Aus cppreference.com
< cpp | io | basic stringbuf
![]() |
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. |
protected: virtual std::basic_streambuf<CharT, Traits>* setbuf( char_type* s, std::streamsize n ) |
||
Wenn
s
ein NULL-Zeiger ist und n
Null ist, hat diese Funktion keine Wirkung .Original:
If
s
is a null pointer and n
is zero, this function has no effect.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.
Ansonsten ist die Wirkung Implementierung definiert: einige Implementierungen nichts tun, während einige Implementierungen deaktivieren std::string Mitglied derzeit als Puffer verwendet und beginnen mit dem Benutzer gelieferten Zeichen Array der Größe
n
, deren erstes Element ist, um durch s
hingewiesen, da die Puffer und der Eingabe / Ausgabe-Zeichenfolge .Original:
Otherwise, the effect is implementation-defined: some implementations do nothing, while some implementations clear the std::string member currently used as the buffer and begin using the user-supplied character array of size
n
, whose first element is pointed to by s
, as the buffer and the input/output character sequence.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 Funktion geschützt ist virtuell, kann es nur durch
pubsetbuf()
oder von Elementfunktionen einer benutzerdefinierten Klasse von std::basic_stringbuf
abgeleitet aufgerufen werden .Original:
This function is protected virtual, it may only be called through
pubsetbuf()
or from member functions of a user-defined class derived from std::basic_stringbuf
.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.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
s | - | Zeiger auf das erste Byte in der vom Benutzer bereitgestellten Puffer oder null
Original: pointer to the first byte in the user-provided buffer or null The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
n | - | die Anzahl von Bytes in dem Benutzer bereitgestellten Puffer oder Null
Original: the number of bytes in the user-provided buffer or zero The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten] Rückgabewert
*this, auf die Basisklasse
std::basic_streambuf
geworfen .Original:
*this, cast to the base class
std::basic_streambuf
.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] Notes
Die veraltete Strompuffers std::strstreambuf oder boost.IOStreams Gerät
boost::basic_array
kann zur Implementierung I / O Puffer über einen vom Benutzer bereitgestellten char-Array in tragbaren Weise werden .Original:
The deprecated stream buffer std::strstreambuf or the boost.IOStreams device
boost::basic_array
may be used to implement I/O buffering over a user-provided char array in portable manner.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
Test für die stringstream die setbuf Funktionalität
Original:
Test for the stringstream's setbuf functionality
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.
#include <iostream> #include <sstream> int main() { std::ostringstream ss; char c[1024] = {}; ss.rdbuf()->pubsetbuf(c, 1024); ss << 3.14 << '\n'; std::cout << c << '\n'; }
Output:
3.14 (on GNU g++/libstdc++ and SunPro C++/roguewave) <nothing> (on MS Visual Studio 2010, SunPro C++/stlport4, CLang++/libc++)
[Bearbeiten] Siehe auch
Beruft setbuf() Original: invokes setbuf() The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion of std::basic_streambuf )
|