Espaces de noms
Variantes
Affichages
Actions

std::basic_istream::sync

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 sync();
Synchronise le tampon d'entrée avec la source de données associée .
Original:
Synchronizes the input buffer with the associated data source.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se comporte comme UnformattedInputFunction, sauf que gcount() n'est pas affectée. Après la construction et la vérification de l'objet sentinelle,
Original:
Behaves as UnformattedInputFunction, except that gcount() is not affected. After constructing and checking the sentry object,
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
si rdbuf() est un pointeur NULL, -1 rendements
Original:
if rdbuf() is a null pointer, returns -1
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, les appels rdbuf()->pubsync(). Si cette fonction renvoie -1, appelle setstate(badbit) et retourne -1. Sinon, retourne 0 .
Original:
Otherwise, calls rdbuf()->pubsync(). If that function returns -1, calls setstate(badbit) and returns -1. Otherwise, returns 0.
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

(Aucun)
Original:
(none)
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

0 en cas de succès, -1 cas d'échec ou si le flux ne prend pas en charge cette opération (pas de tampon) .
Original:
0 on success, -1 on failure or if the stream does not support this operation (is unbuffered).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Notes

Comme readsome(), il est défini par l'implémentation de savoir si cette fonction ne fait rien avec la bibliothèque fournis par flux. Le but est généralement de l'opération de lecture suivante, ramassez tous les changements qui ont été apportés à la séquence d'entrée associé, après la dernière mémoire tampon de flux se remplissait son domaine. Pour y parvenir, synchroniser () peut vider la zone get, ou il peut le remplir, ou il peut ne rien faire. Une exception notable est Visual Studio, où cette opération supprime l'entrée non traitée lorsqu'elle est appelée avec un flux d'entrée standard .
Original:
As with readsome(), it is implementation-defined whether this function does anything with library-supplied streams. The intent is typically for the next read operation to pick up any changes that may have been made to the associated input sequence after the stream buffer last filled its get area. To achieve that, sync() may empty the get area, or it may refill it, or it may do nothing. A notable exception is Visual Studio, where this operation discards the unprocessed input when called with a standard input stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Exemple

Illustre l'utilisation de flux d'entrée sync () avec le fichier d'entrée, mis en œuvre sur certaines plates-formes .
Original:
Demonstrates the use of input stream sync() with file input, as implemented on some platforms.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <fstream>
void file_abc()
{
    std::ofstream f("test.txt");
    f << "abc\n";
}
void file_123()
{
    std::ofstream f("test.txt");
    f << "123\n";
}
int main()
{
    file_abc(); // file now contains "abc"
    std::ifstream f("test.txt");
    std::cout << "Reading from the file\n";
    char c;
    f >> c; std::cout << c;
    file_123(); // file now contains "123"
    f >> c; std::cout << c;
    f >> c; std::cout << c << '\n';
    f.close();
 
    file_abc(); // file now contains "abc"
    f.open("test.txt");
    std::cout << "Reading from the file, with sync()\n";
    f >> c; std::cout << c;
    file_123(); // file now contains "123"
    f.sync();
    f >> c; std::cout << c;
    f >> c; std::cout << c << '\n';
}

Résultat possible :

Reading from the file
abc
Reading from the file, with sync()
a23

[modifier] Voir aussi

[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
synchronise les tampons avec la séquence de caractères associée
Original:
synchronizes the buffers with the associated character sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre virtuelle protégée de std::basic_streambuf) [edit]
synchronise avec le dispositif de stockage sous-jacent
Original:
synchronizes with the underlying storage device
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_ostream) [edit]