std::basic_stringbuf::setbuf
De 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: virtualstd::basic_streambuf<CharT, Traits>* setbuf( char_type* s, std::streamsize n ) | ||
Si
s
est un pointeur nul et n
est égal à zéro, cette fonction n'a aucun effet .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.
Dans le cas contraire, l'effet est définie par l'implémentation: certaines implémentations ne rien faire, tandis que certaines implémentations effacer le membre std::string actuellement utilisé comme tampon et commencer à utiliser le tableau de caractères fournie par l'utilisateur de
n
taille, dont le premier élément est pointé par s
, comme le tampon et la séquence de caractères d'entrée / sortie .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.
Cette fonction est protégée virtuel, il ne peut être appelé par
pubsetbuf()
ou de fonctions membres d'une classe définie par l'utilisateur dérivée de std::basic_stringbuf
.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.
Sommaire |
[modifier]Paramètres
s | - | pointeur vers le premier octet dans le tampon fourni par l'utilisateur ou nulle 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 | - | le nombre d'octets dans le tampon fourni par l'utilisateur ou zéro 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. |
[modifier]Retourne la valeur
*this, jeté à la classe de base
std::basic_streambuf
.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.
[modifier]Notes
Le std::strstreambuf flux obsolète tampon ou la
boost::basic_array
dispositif boost.IOStreams peuvent être utilisés pour mettre en œuvre d'E / S en mémoire tampon sur une fournie par l'utilisateur tableau de caractères de manière portable .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.
[modifier]Exemple
Test de la fonctionnalité setbuf la stringstream de
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';}
Résultat :
3.14 (on GNU g++/libstdc++ and SunPro C++/roguewave) <nothing> (on MS Visual Studio 2010, SunPro C++/stlport4, CLang++/libc++)
[modifier]Voir aussi
Invoque 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. (fonction membre publique de std::basic_streambuf ) |