Espaces de noms
Variantes
Affichages
Actions

std::basic_ostream::operator<<

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

 
 
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_ostream
Les objets globaux
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Les fonctions membres
Original:
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_ostream::basic_ostream
basic_ostream::~basic_ostream
basic_ostream::operator= (C++11)
Entrée formaté
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::operator<<
Entrée non formaté
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::put
basic_ostream::write
Positionnement
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::tellp
basic_ostream::seekp
Divers
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::flush
basic_ostream::swap (C++11)
Classes de membres
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::sentry
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.
operator<<(std::basic_ostream)
 
basic_ostream& operator<<( short value );
basic_ostream& operator<<( unsigned short value );
(1)
basic_ostream& operator<<( int value );
basic_ostream& operator<<( unsigned int value );
(2)
basic_ostream& operator<<( long value );
basic_ostream& operator<<( unsigned long value );
(3)
basic_ostream& operator<<( long long value );
basic_ostream& operator<<( unsigned long long value );
(4) (depuis C++11)
basic_ostream& operator<<( float value );

basic_ostream& operator<<( double value );

basic_ostream& operator<<( long double value );
(5)
basic_ostream& operator<<( bool value );
(6)
basic_ostream& operator<<( const void* value );
(7)
basic_ostream& operator<<( std::basic_streambuf<CharT, Traits>* sb);
(8)
basic_ostream& operator<<( basic_ostream& st,

                           std::ios_base& (*func)(std::ios_base&) );
basic_ostream& operator<<( basic_ostream& st,
                           std::basic_ios<CharT,Traits>& (*func)(std::basic_ios<CharT,Traits>&) );
basic_ostream& operator<<( basic_ostream& st,

                           std::basic_ostream& (*func)(std::basic_ostream&) );
(9)
Insère des données dans le flux .
Original:
Inserts data into the stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Les versions (1-7) de l'opérateur de se comporter comme des fonctions de sortie formatée, et le 8) se comporte comme la version fonction de sortie non formatée. Ces fonctions commencer l'exécution par la construction d'un objet de sentry type, qui vide les tampons de sortie tie()'d si nécessaire et vérifie les erreurs de flux. Après la construction, si les rendements objet sentinelle false, les fonctions renvoient sans tenter aucune sortie. Si une erreur se produit lors de la sortie, les fonctions de sortie formatée mis setstate(ios_base::failbit). Si une exception est levée lors de la sortie, puis ios :: BadBit est activé (l'exception est supprimée, sauf (exceptions()&badbit) != 0, auquel cas il est relancée)
Original:
The (1-7) versions of the operator behave as formatted output functions, and the 8) version behaves as unformatted output function. These functions begin execution by constructing an object of type sentry, which flushes the tie()'d output buffers if necessary and checks the stream errors. After construction, if the sentry object returns false, the functions return without attempting any output. If an error occurs during output, formatted output functions set setstate(ios_base::failbit). If an exception is thrown during output, then ios::badbit is set (the exception is suppressed unless (exceptions()&badbit) != 0, in which case it is rethrown)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1-2)
Si value est short ou int, jette ensuite à unsigned short ou unsigned int si ios_base::flags() & ios_base::basefield est ios_base::oct ou ios_base::hex. Après cela, jette à long en tout cas et sorties comme en 3). Si value est unsigned short ou unsigned int, jette à unsigned long et sorties comme en 3)
Original:
If value is short or int, then casts it to unsigned short or unsigned int if ios_base::flags() & ios_base::basefield is ios_base::oct or ios_base::hex. After that, casts to long in any case and outputs as in 3). If value is unsigned short or unsigned int, casts to unsigned long and outputs as in 3)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3-4)
Insère une valeur entière en appelant num_put::put(). Si la condition de fin de fichier a été rencontré lors de la sortie (put().failed() == true), définit ios::badbit .
Original:
Inserts an integer value by calling num_put::put(). If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Insère une valeur à virgule flottante en appelant num_put::put() Si la condition de fin de fichier a été rencontré lors de la sortie (put().failed() == true), établit ios::badbit .
Original:
Inserts a floating point value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
Inserts bool valeur en appelant num_put::put() Si la condition de fin de fichier a été rencontré lors de la sortie (put().failed() == true), établit ios::badbit .
Original:
Inserts bool value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
Insère une valeur de pointeur générique en appelant num_put::put() Si la condition de fin de fichier a été rencontré lors de la sortie (put().failed() == true), établit ios::badbit .
Original:
Inserts a generic pointer value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
Insère toutes les données du sb. Après avoir construit l'objet sentinelle, vérifie si sb est un pointeur NULL. Si c'est le cas, exécute setstate(badbit) et des sorties. Autrement, extrait les caractères de la séquence d'entrée commandé par sb et les insère dans *this jusqu'à l'une des conditions suivantes sont respectées:
Original:
Inserts all data from sb. After constructing the sentry object, checks if sb is a null pointer. If it is, executes setstate(badbit) and exits. Otherwise, extracts characters from the input sequence controlled by sb and inserts them into *this until one of the following conditions are met:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • de fin de fichier se produit sur la séquence d'entrée;
    Original:
    end-of-file occurs on the input sequence;
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • l'insertion, dans la séquence de sortie échoue (dans ce cas, le caractère d'être ajouté n'est pas extrait);
    Original:
    inserting in the output sequence fails (in which case the character to be inserted is not extracted);
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • une exception se produit (dans ce cas, l'exception est interceptée) .
    Original:
    an exception occurs (in which case the exception is caught).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Si aucun caractère ont été insérés, exécute setstate(badbit). Si une exception a été levée lors de l'extraction, met failbit
Original:
If no characters were inserted, executes setstate(badbit). If an exception was thrown while extracting, sets failbit
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
Appels func(*this);. Cette surcharge est utilisé pour la mise en œuvre de sortie I / O manipulateurs tels que std::endl .
Original:
Calls func(*this);. This overload is used to implement output I/O manipulators such as std::endl.
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

value -
entier, virgule flottante, booléen, ou un pointeur à insérer
Original:
integer, floating-point, boolean, or pointer value to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
func -
fonctionner à appeler
Original:
function to call
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sb -
pointeur sur la streambuffer à lire les données de
Original:
pointer to the streambuffer to read the data from
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] Notes

Il n'y a pas de surcharge pour les pointeurs de pointeurs volatiles ou fonction (autres que ceux avec les signatures acceptées par le 9) de surcharge). Essayez de sortir de tels objets invoque conversion implicite vers bool, et, pour toute valeur de pointeur non nul, la valeur 1 est imprimé (sauf boolalpha a été fixé) .
Original:
There are no overload for pointers to volatile or function pointers (other than the ones with signatures accepted by the 9) overload). Attempting to output such objects invokes implicit conversion to bool, and, for any non-null pointer value, the value 1 is printed (unless boolalpha was set).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Exemple

#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
    std::istringstream input(" \"Some text.\" ");
    volatile int n = 42;
    double f = 3.14;
    bool b = true;;
    std::cout << n   // int overload
              << ' ' // non-member overload
              << std::boolalpha << b // bool overload
              << " " // non-member overload
              << std::fixed << f // double overload
              << input.rdbuf() // streambuf overload
              << &n // bool overload
              << std::endl; // function overload
}

Résultat :

42 true 3.140000 "Some text." true

[modifier] Voir aussi

insère des données de caractères
Original:
inserts character data
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction) [edit]
effectue flux d'E / S de chaînes
Original:
performs stream I/O of strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique)
effectue flux d'entrée et de sortie de bitsets
Original:
performs stream input and output of bitsets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction)
sérialise et désérialise un nombre complexe
Original:
serializes and deserializes a complex number
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique)
effectue flux d'entrée et de sortie sur le moteur de nombres pseudo-aléatoires
Original:
performs stream input and output on pseudo-random number engine
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction) [edit]
effectue flux d'entrée et de sortie sur la distribution de nombre pseudo-aléatoire
Original:
performs stream input and output on pseudo-random number distribution
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction) [edit]
insère un caractère
Original:
inserts a character
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) [edit]
blocs inserts de caractères
Original:
inserts blocks of characters
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) [edit]