Espaces de noms
Variantes
Affichages
Actions

std::basic_istream::get

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

 
 
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_istream
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.
cin
wcin
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_istream::basic_istream
basic_istream::~basic_istream
basic_istream::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_istream::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_istream::get
basic_istream::peek
basic_istream::unget
basic_istream::putback
basic_istream::getline
basic_istream::ignore
basic_istream::read
basic_istream::readsome
basic_istream::gcount
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_istream::tellg
basic_istream::seekg
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_istream::sync
basic_istream::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_istream::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_istream)
 
int_type get();
(1)
basic_istream& get( char_type& ch );
(2)
basic_istream& get( char_type* s, std::streamsize count );
(3)
basic_istream& get( char_type* s, std::streamsize count, char_type delim );
(4)
basic_istream& get( basic_streambuf& strbuf );
(5)
basic_istream& get( basic_streambuf& strbuf, char_type delim );
(6)
Extraits ou les caractères à partir du flux .
Original:
Extracts character or characters from stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Toutes les versions comportent comme UnformattedInputFunctions. Après la construction et la vérification de l'objet sentinelle, ces fonctions effectuent ce qui suit:
Original:
All versions behave as UnformattedInputFunctions. After constructing and checking the sentry object, these functions perform the following:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
lit un caractère et le renvoie si elle est disponible. Dans le cas contraire, les rendements et les ensembles Traits::eof() failbit et eofbit .
Original:
reads one character and returns it if available. Otherwise, returns Traits::eof() and sets failbit and eofbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
lit un caractère et la stocke dans ch si elles sont disponibles. Sinon, laisse ch non modifié et définit failbit et eofbit. Notez que cette fonction ne soit pas surchargé sur les types signed char et unsigned char, contrairement à l'opérateur >> caractère d'entrée formaté .
Original:
reads one character and stores it to ch if available. Otherwise, leaves ch unmodified and sets failbit and eofbit. Note that this function is not overloaded on the types signed char and unsigned char, unlike the formatted character input operator>>.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
même get(s, count, widen('\n')), c'est-lit à la plupart des personnages count-1 et les stocke dans une chaîne de caractères pointée par s jusqu'à '\n' se trouve .
Original:
same as get(s, count, widen('\n')), that is, reads at most count-1 characters and stores them into character string pointed to by s until '\n' is found.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
lit les caractères et les stocke dans les emplacements successifs du tableau de caractères dont le premier élément est pointé par s. Les personnages sont extraites et stockées jusqu'à ce que l'un des événements suivants se produit:
Original:
reads characters and stores them into the successive locations of the character array whose first element is pointed to by s. Characters are extracted and stored until any of the following occurs:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • n-1 caractères ont été stockées
    Original:
    n-1 characters have been stored
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • condition de fin de fichier se produit dans la séquence d'entrée (setstate(eofbit) est appelé)
    Original:
    end of file condition occurs in the input sequence (setstate(eofbit) is called)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • le caractère d'entrée suivant est égal à disposition c delim, tel que déterminé par Traits::eq(c, delim). Ce personnage n'est pas extrait (à la différence basic_istream::getline())
    Original:
    the next available input character c equals delim, as determined by Traits::eq(c, delim). This character is not extracted (unlike basic_istream::getline())
    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é extraites, appelle setstate(failbit). Dans tous les cas, si count>0, un caractère nul (CharT() est stocké dans l'emplacement suivant successives de la matrice .
Original:
If no characters were extracted, calls setstate(failbit). In any case, if count>0, a null character (CharT() is stored in the next successive location of the array.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
get(strbuf, widen('\n')) même, qui est, lit les caractères disponibles et les insère à l'objet donné jusqu'à basic_streambuf '\n' se trouve ..
Original:
same as get(strbuf, widen('\n')), that is, reads available characters and inserts them to the given basic_streambuf object until '\n' is found.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
lit les caractères et les insère à la séquence de sortie contrôlé par l'objet basic_streambuf donné caractères sont extraits et insérés dans strbuf jusqu'à ce que l'un des cas suivants:.
Original:
reads characters and inserts them to the output sequence controlled by the given basic_streambuf object. Characters are extracted and inserted into strbuf until any of the following occurs:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • condition de fin de fichier se produit dans la séquence d'entrée
    Original:
    end of file condition occurs in 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.
  • insérer dans l'... séquence de sortie échoue (dans ce cas, le caractère qui ne peut pas être insérée, ne sont pas extraites)
    Original:
    insert into the output sequence fails (in which case the character that could not 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.
  • le caractère d'entrée suivant est égal à disposition c delim, tel que déterminé par Traits::eq(c, delim). Ce caractère n'est pas extrait .
    Original:
    the next available input character c equals delim, as determined by Traits::eq(c, delim). This 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.
  • une exception se produit (dans auquel cas l'exception est interceptée et non relancée)
    Original:
    an exception occurs (in which case the exception is caught and not rethrown)
    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é extraits, les appels setstate(failbit) .
Original:
If no characters were extracted, calls setstate(failbit).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Toutes les versions définir la valeur de gcount() au nombre de caractères extraits .
Original:
All versions set the value of gcount() to the number of characters extracted.
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

ch -
référence sur le caractère à écrire le résultat
Original:
reference to the character to write the result 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 la chaîne de caractères pour stocker les caractères
Original:
pointer to the character string to store the characters to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
count -
taille de la chaîne de caractères pointée par s
Original:
size of character string pointed to by s
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
delim -
délimitant caractère d'arrêter l'extraction à. Il n'est pas extrait et non mémorisé .
Original:
delimiting character to stop the extraction at. It is not extracted and not stored.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strbuf -
tampon de flux pour lire le contenu d'
Original:
stream buffer to read the content to
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

1)
le caractère extraite ou Traits::eof()
Original:
the extracted character or Traits::eof()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

2-6) *this

[modifier] Exemple

#include <sstream>
#include <iostream>
int main()
{
    std::istringstream s1("Hello, world.");
    char c1 = s1.get(); // reads 'H'
    std::cout << "after reading " << c1 << ", gcount() == " <<  s1.gcount() << '\n';
    char c2;
    s1.get(c2);         // reads 'e'
    char str[5];
    s1.get(str, 5);     // reads "llo,"
    std::cout << "after reading " << str << ", gcount() == " <<  s1.gcount() << '\n';
    std::cout << c1 << c2 << str;
    s1.get(*std::cout.rdbuf()); // reads the rest, not including '\n'
    std::cout << "\nAfter the last get(), gcount() == " << s1.gcount() << '\n';
}

Résultat :

after reading H, gcount() == 1
after reading llo,, gcount() == 4
Hello, world.
After the last get(), gcount() == 7

[modifier] Voir aussi

extrait des blocs de caractères
Original:
extracts 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]
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) [edit]
extrait des tableaux de caractères et de caractères
Original:
extracts characters and character arrays
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) [edit]