Bug 000200

When Created: 01/13/1998 15:16:27
Against DJGPP version: 2.01
By whom:
Abstract: Cout doesn't print to screen until 'endl'.
Cout, on my computer, doesn't appear to display a message using cout unless I tag
a end-of-line message onto the end of it.
I.E. :	This doesn't display : cout << "Hello";
		This does :			   cout << "Hello" << endl;

Note added: 01/26/1998 12:38:44
By whom:
... yet another victim of the concept of 'line buffered I/O' ...

Solution added: 12/08/1998 16:00:15
By whom:
Well, this is not a bug, the cout is line buffered, it is like this in other
C++ compilers like Borland as well as DJGPP.  This speeds up text output.  Now
Either you have to tag on an endl, or do use the flush command.

void main() {
  cout << "Text";  //hasn't printed yet
  cout << " . . . and more text";  //still doesn't display
  //if you don't want to end the line, but display:
  cout.flush();    //Display the lines out

Closed on 12/09/1998 03:00:43: Non-Bug: line-buffering hit newbie
By whom:

  webmaster     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010