D.gnu - Flush to stdio?
- Dleaner (6/6) Apr 01 2013 I was using writef("escape string" ~ "Display string") to try to
- Iain Buclaw (5/11) Apr 01 2013 You mean stdout.flush() ?
- DLearner (3/16) Apr 01 2013 Tried your idea, error message was:
- Iain Buclaw (8/25) Apr 01 2013 stdout should be a struct File if you imported std.stdio;
- DLearner (5/35) Apr 02 2013 Your suggestion of:
- Andrej Mitrovic (2/3) Apr 01 2013 Don't forget seat.putDown() too!
- Iain Buclaw (5/8) Apr 01 2013 Oh, and also forgot about hands.wash().
- Kagamin (2/2) Apr 01 2013 You can also try to call setvbuf on stdio with _IONBF mode to set
- Kagamin (5/5) Apr 01 2013 oops, stdout.
I was using writef("escape string" ~ "Display string") to try to simulate a console, but noticed that the writes are only flushed when a newline is present. Is there a 'flush' function that works with stdio? 'flush()' seems unkown to the compiler, and 'fflush()' seems to be for files, not for writing to the screen.
Apr 01 2013
On 1 April 2013 19:13, Dleaner <bm.email01 gmail.com> wrote:I was using writef("escape string" ~ "Display string") to try to simulate a console, but noticed that the writes are only flushed when a newline is present. Is there a 'flush' function that works with stdio? 'flush()' seems unkown to the compiler, and 'fflush()' seems to be for files, not for writing to the screen.You mean stdout.flush() ? -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Apr 01 2013
On Monday, 1 April 2013 at 18:36:52 UTC, Iain Buclaw wrote:On 1 April 2013 19:13, Dleaner <bm.email01 gmail.com> wrote:Tried your idea, error message was: "No property 'flush' for type '_iobuf'I was using writef("escape string" ~ "Display string") to try to simulate a console, but noticed that the writes are only flushed when a newline is present. Is there a 'flush' function that works with stdio? 'flush()' seems unkown to the compiler, and 'fflush()' seems to be for files, not for writing to the screen.You mean stdout.flush() ?
Apr 01 2013
On 1 April 2013 19:49, DLearner <bm.email01 gmail.com> wrote:On Monday, 1 April 2013 at 18:36:52 UTC, Iain Buclaw wrote:stdout should be a struct File if you imported std.stdio; As if looks like the C stdout is taking precedence, you can either force the use of it via std.stdio.stdout.flush() , or call fflush(stdout). Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';On 1 April 2013 19:13, Dleaner <bm.email01 gmail.com> wrote: I was using writef("escape string" ~ "Display string") to try to simulateTried your idea, error message was: "No property 'flush' for type '_iobuf'a console, but noticed that the writes are only flushed when a newline is present. Is there a 'flush' function that works with stdio? 'flush()' seems unkown to the compiler, and 'fflush()' seems to be for files, not for writing to the screen.You mean stdout.flush() ?
Apr 01 2013
On Monday, 1 April 2013 at 19:07:55 UTC, Iain Buclaw wrote:On 1 April 2013 19:49, DLearner <bm.email01 gmail.com> wrote:Your suggestion of: fflush(stdout); worked. Thank you.On Monday, 1 April 2013 at 18:36:52 UTC, Iain Buclaw wrote:stdout should be a struct File if you imported std.stdio; As if looks like the C stdout is taking precedence, you can either force the use of it via std.stdio.stdout.flush() , or call fflush(stdout). RegardsOn 1 April 2013 19:13, Dleaner <bm.email01 gmail.com> wrote: I was using writef("escape string" ~ "Display string") to try to simulateTried your idea, error message was: "No property 'flush' for type '_iobuf'a console, but noticed that the writes are only flushed when a newline is present. Is there a 'flush' function that works with stdio? 'flush()' seems unkown to the compiler, and 'fflush()' seems to be for files, not for writing to the screen.You mean stdout.flush() ?
Apr 02 2013
On 4/1/13, Iain Buclaw <ibuclaw ubuntu.com> wrote:You mean stdout.flush() ?Don't forget seat.putDown() too!
Apr 01 2013
On 1 April 2013 19:45, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:On 4/1/13, Iain Buclaw <ibuclaw ubuntu.com> wrote:Oh, and also forgot about hands.wash(). -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';You mean stdout.flush() ?Don't forget seat.putDown() too!
Apr 01 2013
You can also try to call setvbuf on stdio with _IONBF mode to set it to non-buffering mode.
Apr 01 2013
oops, stdout. int zero=setvbuf(stdout,null,_IONBF,0); assert(zero==0); or stdio.setvbuf(0,_IONBF);
Apr 01 2013