Thread overview
Suggestion for writef/writefln (or can this be already done now?)
Aug 28, 2004
Id
Aug 28, 2004
Andy Friesen
Aug 28, 2004
Nick
Aug 28, 2004
Walter
Aug 28, 2004
Nick
August 28, 2004
Some commandline programs write, per example, percentage of completion in the
screen.
Those programs usually write a line, and update the numbers by overwriting over
the same line continuously.

Is this possible with writef/writefln or another function already made in Phobos?


August 28, 2004
Id wrote:
> Some commandline programs write, per example, percentage of completion in the
> screen.
> Those programs usually write a line, and update the numbers by overwriting over
> the same line continuously.
> 
> Is this possible with writef/writefln or another function already made in
> Phobos?

You can achieve this by writing a \r (instead of \n) at the end of line.  I don't know if this works the same way in Linux, though.

 -- andy
August 28, 2004
In article <cgqcmd$31fg$1@digitaldaemon.com>, Andy Friesen says...
>
>You can achieve this by writing a \r (instead of \n) at the end of line.
>  I don't know if this works the same way in Linux, though.

Works exactly the same in Linux.

A problem is the writef-doesn't-flush thing, thing though. Unless you write out a newline somewhere, your writefs won't do anything at all. You can get around this by using stdout.writeString from std.string instead.

Nick


August 28, 2004
"Nick" <Nick_member@pathlink.com> wrote in message news:cgqde2$4q$1@digitaldaemon.com...
> In article <cgqcmd$31fg$1@digitaldaemon.com>, Andy Friesen says...
> >
> >You can achieve this by writing a \r (instead of \n) at the end of line.
> >  I don't know if this works the same way in Linux, though.
>
> Works exactly the same in Linux.
>
> A problem is the writef-doesn't-flush thing, thing though. Unless you
write out
> a newline somewhere, your writefs won't do anything at all. You can get
around
> this by using stdout.writeString from std.string instead.

or calling std.c.stdio.fflush(stdout) should work.


August 28, 2004
In article <cgqio8$20p$3@digitaldaemon.com>, Walter says...
>>
>> Works exactly the same in Linux.
>>
>> A problem is the writef-doesn't-flush thing, thing though. Unless you write out a newline somewhere, your writefs won't do anything at all. You can get around this by using stdout.writeString from std.string instead.
>
>or calling std.c.stdio.fflush(stdout) should work.

Yes, but that's so... C-ish :-P

Nick