operator>><div class="t-tr-text">(Std :: basic_istream)<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">(std::basic_istream)</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div>
De cppreference.com
|
|
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. |
<metanoindex/>
<tbody> </tbody> template< class CharT, class Traits > basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>& st, CharT& ch ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, signed char& ch ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, unsigned char& ch ); |
(1) | |
template< class CharT, class Traits> basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>& st, CharT* s ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, signed char* s ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, unsigned char* s ); |
(2) | |
template< class CharT, class Traits, class T > basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>&& st, T& value ); |
(3) | (depuis C++11) |
Effectue des opérations de saisie de caractères .
Original:
Performs character input operations.
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.
1)
Extraits d'un caractère et la stocke dans
ch .Original:
Extracts a character and stores it to
ch.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.
2)
Extraits de caractères successifs et les stocke dans des lieux successifs d'un tableau de caractères dont le premier élément est pointé par
s. L'extraction s'arrête lorsque l'une des conditions suivantes sont respectées:Original:
Extracts successive characters and stores them at successive locations of a character array whose first element is pointed to by
s. The extraction stops if 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.
You can help to correct and verify the translation. Click here for instructions.
- un caractère d'espacement (tel que déterminé par la facette ctype<CharT>) est trouvée. Le caractère blanc n'est pas extraite .Original:a whitespace character (as determined by the ctype<CharT> facet) is found. The whitespace character 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. this->width() - 1caractères sont extraitsOriginal:this->width() - 1characters are extractedThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Dans les deux cas, un caractère null supplémentaire
CharT() valeur est stockée à la fin de la sortie .Original:
In either case, an additional null character value
CharT() is stored at the end of the output.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.
3)
Appelle l'opérateur d'extraction approprié, compte tenu d'une référence rvalue à un objet flux d'entrée (équivalent à
st >> value) .Original:
Calls the appropriate extraction operator, given an rvalue reference to an input stream object (equivalent to
st >> value).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.
Notes
Les versions (1-2) de l'opérateur se comporte comme' fonctions d'entrée formatées. Autrement dit, ils construisent un objet
sentry au début que les bouffées de la cravate () 'd tampons si nécessaire, vérifie les erreurs et les extraits et les rejets tous les protagonistes blancs à moins que le drapeau ios_base :: skipws a été effacé. L'entrée est tentée uniquement si l'objet sentry retourne true .Original:
The (1-2) versions of the operator behave as formatted input functions. That is, they construct a
sentry object at the beginning that flushes the tie()'d buffers if needed, checks for errors, and extracts and discards all leading whitespace characters unless the ios_base::skipws flag was cleared. The input is attempted only if the sentry object returns true.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.
Paramètres
| st | - | flux d'entrée pour extraire les données à partir de
Original: input stream to extract 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. |
| ch | - | une référence à un caractère pour stocker le caractère extrait
Original: reference to a character to store the extracted character to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| s | - | pointeur vers une chaîne de caractères pour stocker les caractères extraits d'
Original: pointer to a character string to store the extracted characters to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Retourne la valeur
st
Exemple
#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
std::string input = "n greetings";
std::istringstream stream(input);
char c;
const int MAX = 6;
char cstr[MAX];
stream >> c >> std::setw(MAX) >> cstr;
std::cout << "c = " << c << '\n'
<< "cstr = " << cstr << '\n';
double f;
std::istringstream("1.23") >> f; // rvalue stream extraction
std::cout << "f = " << f << '\n';
}
Résultat :
c = n
cstr = greet
f = 1.23
Voir aussi
extraits des données formatées Original: extracts formatted data 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) | |