Espaces de noms
Variantes
Affichages
Actions

std::basic_filebuf::setbuf

De cppreference.com
< cpp‎ | io‎ | basic filebuf

 
 
D'entrée / sortie de bibliothèque
I / O manipulateurs
C-style I / O
Tampons
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf (obsolète)
Cours d'eau
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstractions
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Fichier E / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
Chaîne I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Tableau I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream (obsolète)
ostrstream (obsolète)
strstream (obsolète)
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Interface catégorie d'erreur
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category (C++11)
io_errc (C++11)
 
std::basic_filebuf
Fonctions membres publiques
Original:
Public member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_filebuf::basic_filebuf
basic_filebuf::~basic_filebuf
basic_filebuf::operator= (C++11)
basic_filebuf::swap (C++11)
basic_filebuf::is_open
basic_filebuf::open
basic_filebuf::close
Protégé fonctions membres
Original:
Protected member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_filebuf::showmanyc
basic_filebuf::underflow
basic_filebuf::uflow
basic_filebuf::pbackfail
basic_filebuf::overflow
basic_filebuf::setbuf
basic_filebuf::seekoff
basic_filebuf::seekpos
basic_filebuf::sync
basic_filebuf::imbue
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap(std::basic_filebuf) (C++11)
 
protected:
virtual std::basic_streambuf<CharT, Traits>* setbuf( char_type* s, std::streamsize n )
Si s est un pointeur nul et n est égal à zéro, le filebuf devient' unbuffered pour la sortie, ce qui signifie pbase() et pptr() sont nulles et toute sortie est immédiatement envoyé à déposer .
Original:
If s is a null pointer and n is zero, the filebuf becomes unbuffered for output, meaning pbase() and pptr() are null and any output is immediately sent to file.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Dans le cas contraire, un appel à setbuf() remplace la mémoire tampon interne (la séquence de caractères contrôlée) avec le tableau de caractères fournie par l'utilisateur dont le premier élément est pointé par s et permet cet objet std::basic_filebuf d'utiliser jusqu'à octets n dans ce tableau en mémoire tampon .
Original:
Otherwise, a call to setbuf() replaces the internal buffer (the controlled character sequence) with the user-supplied character array whose first element is pointed to by s and allows this std::basic_filebuf object to use up to n bytes in that array for buffering.
The text has been machine-translated via Google Translate.
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_filebuf .
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_filebuf.
The text has been machine-translated via Google Translate.
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.

[modifier] Notes

Les conditions dans lesquelles cette fonction peut être utilisée et la manière dont le tampon fourni est utilisé est défini par l'implémentation .
Original:
The conditions when this function may be used and the way in which the provided buffer is used is implementation-defined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • GCC 4.6 libstdc + +
    Original:
    GCC 4.6 libstdc++
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
setbuf() ne peut être appelée lorsque le std::basic_filebuf n'est pas associé à un fichier (autrement n'a pas d'effet). Avec un tampon fourni par l'utilisateur, la lecture du fichier se lit n-1 octets à la fois .
Original:
setbuf() may only be called when the std::basic_filebuf is not associated with a file (has no effect otherwise). With a user-provided buffer, reading from file reads n-1 bytes at a time.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Clang + + + 3.0 libc
    Original:
    Clang++3.0 libc++
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
setbuf() peut être appelée après l'ouverture du fichier, mais avant tout d'E / S (autrement peut se bloquer). Avec un tampon fourni par l'utilisateur, la lecture du fichier se lit plus grands multiples de 4096 qui s'inscrivent dans la mémoire tampon .
Original:
setbuf() may be called after opening the file, but before any I/O (may crash otherwise). With a user-provided buffer, reading from file reads largest multiples of 4096 that fit in the buffer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Visual Studio 2010
    Original:
    Visual Studio 2010
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
setbuf() peut être appelé à tout moment, même après un certain I / O a eu lieu. Contenu actuel de la mémoire tampon, le cas échéant, sont perdus .
Original:
setbuf() may be called at any time, even after some I/O took place. Current contents of the buffer, if any, are lost.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La norme ne définit pas le comportement de cette fonction, sauf que setbuf(0, 0) appelée avant tout d'E / S a eu lieu est nécessaire pour régler la sortie sans tampon .
Original:
The standard does not define any behavior for this function except that setbuf(0, 0) called before any I/O has taken place is required to set unbuffered output.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[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.

#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

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) [edit]
définit le tampon et la taille d'un fichier stream
Original:
sets the buffer and its size for a file stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction) [edit]