--- $Bill Luebkert <[EMAIL PROTECTED]> wrote:

> 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).

Aggreed on what u r saying...

But I am talking about a "open" in Perl, followed by a
set of "print" cmds, on s block device i.e. my hard
drive...and in this scenario, it is fully buffered by
default.

> 
> > 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]);
> 

These are the last options I have in mind...

But I was just wondering if there is anything else
which probably I don't know and can do my job in a
much smarter way..

-Arijit


> 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)
> 


Arijit Das
Infosys Technologies Ltd.
Mangalore - 575 006, India
Cell Phone: 9448135200
E-Mail: [EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to