std::basic_streambuf::pubsetbuf, std::basic_streambuf::setbuf
De cppreference.com
< cpp | io | basic streambuf
![]() |
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. |
basic_streambuf<CharT,Traits>* pubsetbuf( char_type* s, std::streamsize n ) |
(1) | |
protected: virtual basic_streambuf<CharT,Traits>* setbuf( char_type* s, std::streamsize n ) |
(2) | |
Appels
2) setbuf(s, n)
de la classe la plus dérivéeOriginal:
Calls
setbuf(s, n)
of the most derived classThe 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.
La version classe de base de cette fonction n'a aucun effet. Les classes dérivées peuvent substituer cette fonction pour permettre le retrait ou le remplacement de la séquence de caractères contrôlée (le tampon) avec un tableau fourni par l'utilisateur, ou pour toute autre application spécifique but .
Original:
The base class version of this function has no effect. The derived classes may override this function to allow removal or replacement of the controlled character sequence (the buffer) with a user-provided array, or for any other implementation-specific purpose.
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
Original: pointer to the first byte in the user-provided buffer 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
Original: the number of bytes in the user-provided buffer 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
[modifier] Exemple
fournir un tampon 10k pour la lecture. Sur Linux, l'utilitaire strace peut être utilisé pour observer le nombre réel d'octets lus
Original:
provide a 10k buffer for reading. On linux, the strace utility may be used to observe the actual number of bytes read
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 <fstream> #include <iostream> #include <string> int main() { int cnt=0; std::ifstream file; char buf[10241]; file.rdbuf()->pubsetbuf(buf, sizeof buf); file.open("/usr/share/dict/words"); for (std::string line; getline(file, line); ) { cnt++; } std::cout << cnt << '\n'; }
[modifier] Voir aussi
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
fourni par l'utilisateur fournit tampon ou désactive cette filebuf mémoire sans tampon Original: provides user-supplied buffer or turns this filebuf unbuffered The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre virtuelle protégée de std::basic_filebuf )
|