Thread overview | |||||
---|---|---|---|---|---|
|
November 14, 2005 continued: Bug or what? | ||||
---|---|---|---|---|
| ||||
Also, writefln or writef("\n") doesn't seems to suffer from this. Setting a writefln("") just before the pause call fixes all. Maybe it has something to do with the newline. Neglecting to flush until a newline? Tom |
November 14, 2005 Re: continued: Bug or what? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tomás Rossi | On Mon, 14 Nov 2005 03:09:30 +0000 (UTC), Tomás Rossi <Tomás_member@pathlink.com> wrote:
> Also, writefln or writef("\n") doesn't seems to suffer from this.
> Setting a writefln("") just before the pause call fixes all.
> Maybe it has something to do with the newline. Neglecting to flush until a newline?
I suspect the buffer flushes on a newline, so the writef goes into the buffer but isn't flushed, then, I suspect the pause text doesn't go into the buffer but straight to the console. So it gets there before the buffered text.
Regan
|
November 14, 2005 Re: continued: Bug or what? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | In article <opsz7n250r23k2f5@nrage.netwin.co.nz>, Regan Heath says... > >On Mon, 14 Nov 2005 03:09:30 +0000 (UTC), Tomás Rossi <Tomás_member@pathlink.com> wrote: >> Also, writefln or writef("\n") doesn't seems to suffer from this. >> Setting a writefln("") just before the pause call fixes all. >> Maybe it has something to do with the newline. Neglecting to flush until >> a newline? > >I suspect the buffer flushes on a newline, so the writef goes into the buffer but isn't flushed, then, I suspect the pause text doesn't go into the buffer but straight to the console. So it gets there before the buffered text. > >Regan The 'terminal' IO library routines underlying phobos will flush on a newline or close by default for both Windows and Linux. So it isn't strictly a bug unless it's defined otherwise. This default behaviour can be changed by using std.c.stdio.setvbuf(...); |
Copyright © 1999-2021 by the D Language Foundation