Arijit Das wrote:

> I think you are missing out here...

Let's hope not.

> DIsk files are always fully-buffered, STOUT is line
> buffered and STDERR is unbuffered.

Not true on all systems - buffering varies on different target
devices, system calls and OS's.  UNIX 'write (2)' to a disk file
is not buffered - unlike the stdio interface (see last comment
below).

> My problem is I have to do a kill -9 at the end. And a
> process dying with kill -9 doesn't get a scope to do
> its cleanup like flushing open files handles and
> closing them.

If all you want to do is make sure your data is unbuffered, then
turn off the buffering after opening the file.

You can select it and unbuffer it using:

        $oldh = select (FH);
        $| = 1;
        select ($oldh);

or one step version:

        select ((select (FH), $| = 1)[0]);

Using syswrite will also bypass any buffered IO since it uses the
'write' system call, but be careful mixing it with stdio (non-'sys')
functions.

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to