TITLE: Unit-buffering cout PROBLEM: rad2r@uvacs.cs.Virginia.EDU (Robert DeLine) How do I get cout to be unbuffered like cerr is? (i.e. What's the iostream equivalent of the old C expression setbuf(stdout,NULL); ?) In general, what's a good source of information about iostreams? (The chapter in Stroustrup's 2nd Ed. is not comprehensive.) RESPONSE: steve@taumet.com (Steve Clamage) First of all, cerr isn't unbuffered, it is unit-buffered. This is a useful compromise which flushes the buffer after each insertion, rather than after each character. You can simply set the unit-buffer flag (ios::unitbuf) in the stream to get this effect. (If you do unformatted output, you still have to flush manually.) Alternatively, you can use the setbuf member function of the buffer class: cout.rdbuf()->setbuf(0,0); This is not guaranteed actually to unbuffer the stream, depending on a number of implementation details. Finally, you can create an unbuffered ofstream attached to file descriptor 1 (on most systems), and use that instead of cout. At the moment, the best source of detailed data on iostreams is the USL C++ library documentation, which you can buy directly from USL if it didn't come with your implementation. Addison-Wesley will be publishing a book by Steven Teale on iostreams sometime this year. I don't know the exact title of the book or the publication date. RESPONSE: vinoski@apollo.hp.com (Steve Vinoski) I believe the title is "IOStreams Cookbook" and last I heard it will be available in June. The ISBN is 0-201-59641-X. Addison-Wesley can be reached at (617)944-3700.