On Mon, Mar 24, 2003 at 05:08:08PM +1100, James Gregory wrote:
> On Mon, 2003-03-24 at 17:08, Amanda Wynne wrote:
> > I mean I only get output to the screen about every 20th call to printf.
> 
> stdout is line buffered by default IIRC. You probably want to switch
> your pty to "hot" mode or something - I don't recall the details, but
> search for "stdout buffer mode" - you should find something useful.

See setbuf(3):

    The  three  types  of  buffering available are unbuffered,
    block buffered, and line buffered.  When an output  stream
    is unbuffered, information appears on the destination file
    or terminal as soon as written; when it is block  buffered
    many  characters are saved up and written as a block; when
    it is line buffered characters are saved up until  a  new-
    line  is  output or input is read from any stream attached
    to a terminal  device  (typically  stdin).

To make stdout unbuffered, call setbuf(stdout, _IONBF);


Cheers,

John


> 
> Just a guess.
> 
> James.
> 
> > 
> > 
> > On Monday 24 Mar 2003 5:00 pm, Ian Su wrote:
> > > \r just moves the cursor, it won't "update the line". Whatever you mean by
> > > that.
> > >
> > >   printf("hello world\rfoo bar\n");
> > >
> > > would print
> > >
> > >   foo barorld
> > >
> > > so it could be a matter of inserting spaces after your string?
> > >
> > 
> 
> -- 
> SLUG - Sydney Linux User's Group - http://slug.org.au/
> More Info: http://lists.slug.org.au/listinfo/slug

-- 
whois [EMAIL PROTECTED]
GPG key id: 0xD59C360F
http://kirriwa.net/john/
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to