Re: buffered output on solaris?

Fons Rademakers (rdm@pcsalo.cern.ch)
Tue, 8 Jun 1999 09:56:00 +0200 (METDST)


Hi Charles,

use:

cout << "Print something" << endl;

or

cout << "Print something\n" << flush;

option one preferred since endl inplies a flush.

Cheers, Fons.

>
> 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
>
> and root is: ver 2.21/08
>
> thanks... Charles.
>
> --
> +---------------------------------------------------------------------------+
> | Charles Leggett | |
> | Lawrence Berkeley National Lab | <CGLeggett@lbl.gov> |
> | 1 Cyclotron Road, MS 50B-3238 | HCG / NERSC : Atlas / D0 |
> | Berkeley, CA 94720 | Eagles may soar, but weasels don't |
> | (510) 495-2930 Office: 50B-3201 | get sucked into jet engines. |
> +---------------------- http://annwm.lbl.gov/~leggett ----------------------+
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910