std::basic_istream::sync

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

 
 
Ingresso / libreria di output
I / O manipolatori
C-style I / O
Buffer
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(deprecato)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Astrazioni
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
File I / 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
String 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
Array 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(deprecato)
ostrstream(deprecato)
strstream(deprecato)
Tipi
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
Errore categoria interfaccia
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
Gli oggetti globali
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
Membri funzioni
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)
Ingresso formattato
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>>
Ingresso non formattato
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
Posizionamento
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
Varie
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)
Membri classi
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
Non membri funzioni
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();
Sincronizza il buffer di input con l'origine dati associata.
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.
Si comporta come UnformattedInputFunction, salvo che gcount() non è interessato. Dopo la costruzione e la verifica dell'oggetto sentinella,
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.
se rdbuf() è un puntatore nullo, restituisce -1
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.
Altrimenti, le chiamate rdbuf()->pubsync(). Se tale funzione restituisce -1, chiama setstate(badbit) e ritorna -1. In caso contrario, restituisce 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.

Indice

[modifica]Parametri

(Nessuno)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica]Valore di ritorno

0 in caso di successo, -1 in caso di fallimento o se il flusso non supporta questa operazione (è unbuffered).
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.

[modifica]Note

Come readsome(), è definito dall'implementazione se questa funzione fa qualcosa con biblioteca fornita flussi. L'intento è in genere per l'operazione successiva lettura per raccogliere tutte le modifiche che potrebbero essere apportate alla sequenza di input associato dopo buffer del flusso ultima compilazione di tutta la zona di ottenere. A tal fine, la sincronizzazione () può svuotare l'area get, o può riempirla, o può fare nulla. Una notevole eccezione è Visual Studio, in cui questa operazione elimina l'ingresso non elaborato quando viene chiamato con un flusso di input 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.

[modifica]Esempio

Viene illustrato l'utilizzo di sincronizzazione in ingresso corrente () con file di input, come attuato su alcune piattaforme .
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';}

Possible output:

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

[modifica]Vedi anche

[virtuale]
sincronizza i buffer con la sequenza di caratteri associata
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.

(virtuale protetto funzione of std::basic_streambuf membro)[modifica]
sincronizza con il dispositivo di archiviazione sottostante
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.

(metodo pubblico)[modifica]
close