Flush to stdio?

DLearner bmqazwsx123 at gmail.com
Tue Apr 2 07:21:52 PDT 2013


On Monday, 1 April 2013 at 19:07:55 UTC, Iain Buclaw wrote:
> On 1 April 2013 19:49, DLearner <bm.email01 at gmail.com> wrote:
>
>> On Monday, 1 April 2013 at 18:36:52 UTC, Iain Buclaw wrote:
>>
>>> On 1 April 2013 19:13, Dleaner <bm.email01 at 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() ?
>>>
>>
>> Tried your idea, error message was:
>> "No property 'flush' for type '_iobuf'
>>
>
> 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

Your suggestion of:

fflush(stdout);

worked.

Thank you.


More information about the D.gnu mailing list