Namespace
Varianti

std::flush

Da cppreference.com.
< cpp‎ | io‎ | manip

 
 
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)
 
Ingresso / uscita manipolatori
Virgola mobile formattazione
Original:
Floating-point formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formattazione Integer
Original:
Integer formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formattazione Boolean
Original:
Boolean formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
boolalpha
noboolalpha
Larghezza del campo e il controllo di riempimento
Original:
Field width and fill control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Di formattazione
Original:
Other formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Elaborazione degli spazi vuoti
Original:
Whitespace processing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uscita di lavaggio
Original:
Output flushing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
flush
endl
Flag di stato manipolazione
Original:
Status flags manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tempo e denaro I / O
Original:
Time and money I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
get_money(C++11)
get_time(C++11)
put_money(C++11)
put_time(C++11)
 
Defined in header <ostream>
template< class CharT, class Traits >
std::basic_ostream<charT,traits>& flush( std::basic_ostream<CharT, Traits>& os );
Svuota la sequenza di output os come se chiamando os.flush().
Original:
Flushes the output sequence os as if by calling os.flush().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si tratta di un solo output manipolatore di I / O, può essere chiamato con espressioni quali out << std::flush per qualsiasi out di std::basic_ostream tipo.
Original:
This is an output-only I/O manipulator, it may be called with an expression such as out << std::flush for any out of type std::basic_ostream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Indice

[modifica] Note

Questo manipolatore può essere usato per produrre una linea incompleta di uscita immediatamente, ad esempio durante la visualizzazione di uscita da un processo di lunga durata, la registrazione delle attività di più thread o la registrazione di attività di un programma che potrebbe bloccarsi in modo imprevisto. Un filo esplicito std::cout è necessario anche prima di una chiamata a std::system, se il processo generato esegue qualsiasi schermata I / O (un esempio comune è std::system("pause") su Windows). Nella maggior parte degli altri soliti interattivi I / O scenari, std::endl è ridondante se utilizzato con std::cout perché ogni input da std::cin, uscita std::cerr, o cessazione programma forza una chiamata a std::cout.flush().
Original:
This manipulator may be used to produce an incomplete line of output immediately, e.g. when displaying output from a long-running process, logging activity of multiple threads or logging activity of a program that may crash unexpectedly. An explicit flush of std::cout is also necessary before a call to std::system, if the spawned process performs any screen I/O (a common example is std::system("pause") on Windows). In most other usual interactive I/O scenarios, std::endl is redundant when used with std::cout because any input from std::cin, output to std::cerr, or program termination forces a call to std::cout.flush().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Quando una linea completa di uscita deve essere lavata, il manipolatore std::endl può essere utilizzato.
Original:
When a complete line of output needs to be flushed, the std::endl manipulator may be used.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Quando tutte le operazioni di uscita deve essere lavata, il manipolatore std::unitbuf può essere utilizzato.
Original:
When every output operation needs to be flushed, the std::unitbuf manipulator may be used.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Parametri

os -
riferimento al flusso di output
Original:
reference to output stream
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

os (riferimento al flusso dopo la manipolazione)
Original:
os (reference to the stream after manipulation)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Esempio

Senza std :: a filo, il risultato sarebbe lo stesso, ma potrebbero non essere visualizzate in tempo reale .
Original:
Without std::flush, the output would be the same, but may not appear in real time.
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 <chrono>
template<typename Diff>
void log_progress(Diff d)
{
    std::cout << "..("
              << std::chrono::duration_cast<std::chrono::milliseconds>(d).count()
              << " ms).." << std::flush;
}
int main()
{
    volatile int sink=0;
 
    auto t1 = std::chrono::high_resolution_clock::now();
    for(int j=0; j<5; ++j)
    {
        for(int n=0; n<10000; ++n)
            for(int m=0; m<20000; ++m)
                sink += m*n; // do some work
        auto now = std::chrono::high_resolution_clock::now();
        log_progress(now - t1);
    }
    std::cout << '\n';
}

Output:

..(450 ms)....(901 ms)....(1350 ms)....(1800 ms)....(2250 ms)..

[modifica] Vedi anche

controlla se l'uscita viene lavata dopo ogni operazione
Original:
controls whether output is flushed after each operation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione) [edit]
uscite '\n' e colori nel flusso di output
Original:
outputs '\n' and flushes the output stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione di modello) [edit]
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.

(membro pubblico of std::basic_ostream funzione) [edit]