Thema: cout Problem
Einzelnen Beitrag anzeigen
Ungelesen 11.11.12, 09:52   #7
Madddin_89
Newbie
 
Registriert seit: Jun 2010
Beiträge: 56
Bedankt: 10
Madddin_89 ist noch neu hier! | 0 Respekt Punkte
Standard

Buffering and flush

When you send output to a stream, it does not necessarily get printed immediately. Rather, it may wait in a buffer until some unspecified event, e.g. buffer full enough, reading from input, or exit from program. The details may vary.

Buffering makes it faster to print a large amount of output, particularly if you are producing the output bit-by-bit (e.g. one character at a time). However, it is a nuisance for output used in debugging (e.g. a statement that informs you that step 3 of your algorithm has been finished).

Forcing all buffered output to actually be printed is known as "flushing" the stream. A flush can be forced by calling the flush function associated with each output stream, inserting the magic variable flush into the stream, or inserting endl.

cout << flush;
cout.flush();
cout << endl;

Quelle: http://www.cs.hmc.edu/~geoff/classes.../notes/io.html

könnte dir bei deinem Problem evtl. helfen.

Eine weitere Möglichkeit wäre, dass "Sleep()" durch eine große for-schleife zu ersetzen, die einfach nichts macht.
(Mit Sleep gibt der Prozess seine Rechte beim Betriebssystem ab, also kann es auch vorkommen, dass der Output-Stream
erstmal lahmgelegt wird...)
Madddin_89 ist offline   Mit Zitat antworten