GDC - no flush to stdio?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Apr 1 11:59:10 PDT 2013


On Mon, Apr 01, 2013 at 08:53:40PM +0200, DLearner wrote:
> On Monday, 1 April 2013 at 18:44:16 UTC, Ali Çehreli wrote:
> >On 04/01/2013 11:37 AM, DLearner wrote:
> >>I was trying to use writef("Escape string" ~ "Display string") to
> >>simulate a full-screen console.  But writef doesn't seem to flush
> >>until a newline entered (which disturbs cursor position).
> >>
> >>I would have expected a 'flush()' function, but 'flush()' itself
> >>produces an error (does not exist), and 'fflush()' seems to be for
> >>file use, not for writing to a screen (stdio).
> >>
> >>Please, how do I force a flush to stdio?
> >
> >writef is a shorthand for stdout.writef because stdout is actually
> >a FILE, so stdout.flush() should work.
> >
> >Ali
> 
> I tried this but got:
> "No property 'flush' for type '_iobuf'"

Did you import std.stdio? I tried the following and it works:

	import std.stdio;
	void main() {
		write("abc");
		stdout.flush();
	}

Do you have a code snippet that you're having trouble with, so that we
can look at it more carefully? It's a bit hard to tell what your problem
might be without seeing the actual code.


> Sorry but please note I also posted to the GDC forum - the non-return
> from the anti-spam delay made me think this posting had failed.

This forum (d-learn) is the correct forum for posting questions about
learning D. The GDC forum is for discussions specific to the GDC
compiler (building the GDC compiler, bugs/issues with GDC, etc.).


T

-- 
The best compiler is between your ears. -- Michael Abrash


More information about the Digitalmars-d-learn mailing list