Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 28, 2004 Suggestion for writef/writefln (or can this be already done now?) | ||||
---|---|---|---|---|
| ||||
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 Re: Suggestion for writef/writefln (or can this be already done now?) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Id | 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 Re: Suggestion for writef/writefln (or can this be already done now?) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | 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 Re: Suggestion for writef/writefln (or can this be already done now?) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick | "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 Re: Suggestion for writef/writefln (or can this be already done now?) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | 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 |
Copyright © 1999-2021 by the D Language Foundation