| www.delorie.com/djgpp/bugs/show.cgi | search |
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;
... yet another victim of the concept of 'line buffered I/O' ...
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
}| webmaster donations bookstore | delorie software privacy |
| Copyright © 2010 by DJ Delorie | Updated Jul 2010 |