std::basic_streambuf::pubsetbuf, std::basic_streambuf::setbuf
Da 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) | |
Chama
2) setbuf(s, n)
da classe mais derivadaOriginal:
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.
A versão classe base desta função não tem efeito. As classes derivadas podem substituir essa função para permitir a remoção ou substituição da seqüência de caracteres controlada (buffer) com uma matriz fornecida pelo usuário, ou para qualquer propósito específico de implementação outros.
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.
Índice |
[editar] Parâmetros
s | - | ponteiro para o primeiro byte no buffer fornecidos pelo utilizador
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 | - | o número de bytes no buffer do usuário fornecida
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. |
[editar] Valor de retorno
*this
[editar] Exemplo
fornecer um amortecedor para a leitura de 10k. No Linux, o utilitário strace podem ser usados para observar o número real de bytes lidos
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'; }
[editar] Veja também
[virtual] |
fornece fornecido pelo usuário tampão ou transforma este filebuf unbuffered 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. (virtual protegido of std::basic_filebuf função de membro)
|