std::basic_streambuf::pubsetbuf, std::basic_streambuf::setbuf
Da cppreference.com.
< cpp | io | basic streambuf
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
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) | |
Chiamate
2) setbuf(s, n)
della classe più derivataOriginal:
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 versione della classe base di questa funzione non ha effetto. Le classi derivate possono eseguire l'override di questa funzione per consentire la rimozione o sostituzione della sequenza di caratteri controllata (il buffer) con un fornito dall'utente matrice, o per qualsiasi altra applicazione specifica finalità.
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.
Indice |
[modifica] Parametri
s | - | puntatore al primo byte nel tampone fornito dall'utente
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 | - | il numero di byte nel buffer di fornito dall'utente
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. |
[modifica] Valore di ritorno
*this
[modifica] Esempio
fornire un buffer 10k per la lettura. Su Linux, il programma di utilità strace può essere utilizzato per osservare il numero effettivo di byte letti
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'; }
[modifica] Vedi anche
[virtuale] |
fornisce fornito dall'utente buffer o trasforma questo filebuf senza buffer 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. (virtuale protetto funzione of std::basic_filebuf membro)
|