www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - flush and stdout

reply Tom <Tom_member pathlink.com> writes:
Is there an alternative to:

fflush(std.stdio.stdout); 

?

Certainly we can't do something like std.stdio.stdout.flush() as stdout doesn't
seem to be of Stream type (e.g. from dmd compiler "no property 'flush' for type
'_iobuf [60]'").

On the other hand one can do this:

File inp = new File("filename", FileMode.In);
scope(exit) inp.close();
..
inp.flush();

Is there a Stream object for stdout? If there is one, why it isn't included in
std.stream? If there isn't, why not to add one?

Thx,

--
Tom:
May 17 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Tom" <Tom_member pathlink.com> wrote in message 
news:e4fj4n$4m7$1 digitaldaemon.com...
 Is there an alternative to:

 fflush(std.stdio.stdout);
Try: import std.cstream; ... dout.writefln("Hello"); dout.flush(); dout is a wrapper around stdout using a type of D Stream.
May 17 2006
parent Tom <Tom_member pathlink.com> writes:
In article <e4fm51$9ej$1 digitaldaemon.com>, Jarrett Billingsley says...
"Tom" <Tom_member pathlink.com> wrote in message 
news:e4fj4n$4m7$1 digitaldaemon.com...
 Is there an alternative to:

 fflush(std.stdio.stdout);
Try: import std.cstream; ... dout.writefln("Hello"); dout.flush(); dout is a wrapper around stdout using a type of D Stream.
Oops! Thanks, I've missed that module :) -- Tom;
May 17 2006