www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - stdout.flush

reply Charles Hixson via Digitalmars-d-learn writes:
Using:
dmd --version
DMD64 D Compiler v2.071.0

on debian Linux, and importing:
import    std.stdio;

the line:
     flush();
causes:
nt.d(29): Error: undefined identifier 'flush', did you mean function 
'fflush'?

This appears solved by doing stdout.flush;  (compiles, but I'm still 
writing the code) but as write, writef, etc. don't require explicitly 
mentioning stdout, I think that the documentation for flush should 
mention that the file must be specified.  Currently it seems to imply 
that all files will be flushed.
May 25 2016
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/25/16 2:09 PM, Charles Hixson via Digitalmars-d-learn wrote:
 Using:
 dmd --version
 DMD64 D Compiler v2.071.0

 on debian Linux, and importing:
 import    std.stdio;

 the line:
      flush();
 causes:
 nt.d(29): Error: undefined identifier 'flush', did you mean function
 'fflush'?

 This appears solved by doing stdout.flush;  (compiles, but I'm still
 writing the code) but as write, writef, etc. don't require explicitly
 mentioning stdout, I think that the documentation for flush should
 mention that the file must be specified.  Currently it seems to imply
 that all files will be flushed.
write, writef, etc. are all forwarding functions to stdout.write, stdout.writef, etc. It's not that it doesn't require mentioning stdout, it's that you have a shortcut defined. Just like C has printf, and fprintf, we have both. But because this isn't C, we don't need to change the name :) flush as a standalone function is not supported at this time. I doubt it will be. -Steve
May 25 2016