RE:buffered output on solaris?

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Tue Jun 08 1999 - 15:12:35 MEST


Charles,

First, this is pure C++ question.
iostream is supposed to be buffered. But behavior is platform dependent.
If you want to flush the buffer every line for iostreams  you should use
endl.

  cout << "Print something" << endl;

Please read C++ book for detail.

Thank you
Masaharu Goto


======================================================================
When including shared object libraries into root, I've come across the
following peculiarity: the output seems to be buffered on a solaris4
platform. When I have a class with the following member:

Foo::Bar() {
  cout << "Print something\n";
}

and execute it, nothing gets printed out. It takes a number of iterations
of the function before anything gets printed out. However, if I do

Foo::Bar() {
   printf("Print something\n");
}

this prints out immediately. 

I don't have this problem on a Linux system.

- is this a feature or a bug?

- if this is intentional, is there something that I can set to force the
output buffers to be flushed on every 'cout' statement?

The platform is:
uname -a: SunOS starsu00 5.6 Generic_105181-13 sun4u sparc



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:34 MET