std::basic_streambuf::pubsetbuf, std::basic_streambuf::setbuf — cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(1) | |
|
|
(2) | |
1)
Appels setbuf(s, n) de la classe la plus dérivée
Original:
Calls setbuf(s, n) of the most derived class
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
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.
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. |
| 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. |
Retourne la valeur
*this
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.
#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'; }
Voir aussi
[ virtuel Original: virtual The text has been machine-translated via Google Translate. |
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. (fonction membre virtuelle protégée de std::basic_filebuf) [edit]
|