www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - There is not std.stdio.flush

reply Haruki Shigemori <rayerd.wiz gmail.com> writes:
Hi.

The std.cstream.dout has a member function dout.flush.
But the std.stdio has not a function flush or a similar function.
Why? Don't you want to have it?
Give me the std.stdio.flush!
Jul 20 2009
next sibling parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Haruki Shigemori wrote:
 Hi.
 
 The std.cstream.dout has a member function dout.flush.
 But the std.stdio has not a function flush or a similar function.
 Why? Don't you want to have it?
 Give me the std.stdio.flush!
All the write functions in std.stdio (write, writeln, writef, writefln) flush automatically, so there is no need for a separate flush function. -Lars
Jul 20 2009
next sibling parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Lars T. Kyllingstad wrote:
 Haruki Shigemori wrote:
 Hi.

 The std.cstream.dout has a member function dout.flush.
 But the std.stdio has not a function flush or a similar function.
 Why? Don't you want to have it?
 Give me the std.stdio.flush!
All the write functions in std.stdio (write, writeln, writef, writefln) flush automatically, so there is no need for a separate flush function. -Lars
Sorry, my mistake. It seems only writef and writefln flush automatically. :( -Lars
Jul 20 2009
parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
Lars T. Kyllingstad wrote:
 Lars T. Kyllingstad wrote:
 Haruki Shigemori wrote:
 Hi.

 The std.cstream.dout has a member function dout.flush.
 But the std.stdio has not a function flush or a similar function.
 Why? Don't you want to have it?
 Give me the std.stdio.flush!
All the write functions in std.stdio (write, writeln, writef, writefln) flush automatically, so there is no need for a separate flush function. -Lars
Sorry, my mistake. It seems only writef and writefln flush automatically. :(
I don't think so. If I run my code in the Eclipse console it doesn't flush automatically and I have to do fflush(stdout). I think it depends on the console implementation.
Jul 20 2009
parent "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Ary Borenszweig wrote:
 Lars T. Kyllingstad wrote:
 Lars T. Kyllingstad wrote:
 Haruki Shigemori wrote:
 Hi.

 The std.cstream.dout has a member function dout.flush.
 But the std.stdio has not a function flush or a similar function.
 Why? Don't you want to have it?
 Give me the std.stdio.flush!
All the write functions in std.stdio (write, writeln, writef, writefln) flush automatically, so there is no need for a separate flush function. -Lars
Sorry, my mistake. It seems only writef and writefln flush automatically. :(
I don't think so. If I run my code in the Eclipse console it doesn't flush automatically and I have to do fflush(stdout). I think it depends on the console implementation.
That's weird, and probably a bug somewhere. This is the definition of File.writeln() from the latest Phobos: void writeln(S...)(S args) { write(args, '\n'); .fflush(p.handle); } where p.handle is the FILE* pointer. -Lars
Jul 20 2009
prev sibling parent BCS <ao pathlink.com> writes:
Reply to Lars,

 Haruki Shigemori wrote:
 
 Hi.
 
 The std.cstream.dout has a member function dout.flush.
 But the std.stdio has not a function flush or a similar function.
 Why? Don't you want to have it?
 Give me the std.stdio.flush!
All the write functions in std.stdio (write, writeln, writef, writefln) flush automatically, so there is no need for a separate flush function.
IIRC writef only forces a flush on a newline.
Jul 20 2009
prev sibling parent reply Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
2009/7/20 Haruki Shigemori <rayerd.wiz gmail.com>:
 Hi.

 The std.cstream.dout has a member function dout.flush.
 But the std.stdio has not a function flush or a similar function.
 Why? Don't you want to have it?
 Give me the std.stdio.flush!
You don't need it. Just import std.c.stdio and fflush(stdout).
Jul 20 2009
parent reply Haruki Shigemori <rayerd.wiz gmail.com> writes:
Jarrett Billingsley wrote:
 2009/7/20 Haruki Shigemori <rayerd.wiz gmail.com>:
 Hi.

 The std.cstream.dout has a member function dout.flush.
 But the std.stdio has not a function flush or a similar function.
 Why? Don't you want to have it?
 Give me the std.stdio.flush!
You don't need it. Just import std.c.stdio and fflush(stdout).
uhmm... I think std.c.stdio is a port of the C language library, std.stdio must has flush or fflush as the D language library.
Jul 20 2009
parent torhu <no spam.invalid> writes:
On 20.07.2009 17:01, Haruki Shigemori wrote:
 uhmm...
 I think std.c.stdio is a port of the C language library,
 std.stdio must has flush or fflush as the D language library.
It's not a port, it _is_ the std C library. std.stdio just adds functionality on top of what C provides. That's what Phobos IO is, it's meant to be possible to use it interchangeably with C IO. Tango IO is different, it uses the lowlevel OS APIs instead.
Jul 20 2009