delorie.com/djgpp/bugs/show.cgi | search |
For example, I have this following code: { cout << "Hello"; cout << " The stream library doesn't work very well"; cout << " It's very strange"; } I will only see the first two sentence. The stream doesn't output until the next call to 'cout'. An when the next call come, it ouput the first one. Very, very strange!
This is a FAQ problem: There's no bug in the lib. It's just using line-buffered I/O. Putting the '\n' at the *end* of each string, instead of the beginning (or the more C++ -typical '<< endl' instead) would help, here.
Use '<< endl', ' ' will not clear the output buffer where 'endl' will. Also '<< flush' can be used to not go to the next line.
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |