Thread overview
How to change text while running in console?
Apr 27, 2015
Israel
Apr 27, 2015
Vladimir Panteleev
Apr 27, 2015
Adam D. Ruppe
Apr 27, 2015
Israel
Apr 27, 2015
Adam D. Ruppe
Apr 27, 2015
Vladimir Panteleev
April 27, 2015
I remember doing this in C++ and it worked but is this possible in D?

Its basically updating information in the console window without constantly printing new lines.

http://stackoverflow.com/questions/14043148/how-to-change-text-while-running-the-console
April 27, 2015
On Monday, 27 April 2015 at 02:26:01 UTC, Israel wrote:
> I remember doing this in C++ and it worked but is this possible in D?
>
> Its basically updating information in the console window without constantly printing new lines.
>
> http://stackoverflow.com/questions/14043148/how-to-change-text-while-running-the-console

write(info, "\r"); stdout.flush();

E.g. with percent:

writef("%d%%\r", current * 100 / total); stdout.flush();
April 27, 2015
On Monday, 27 April 2015 at 02:26:01 UTC, Israel wrote:
> I remember doing this in C++ and it worked but is this possible in D?

Have you tried it yet? The solution is basically the same, you just write out the carriage return character to the device.
April 27, 2015
On Monday, 27 April 2015 at 02:30:36 UTC, Vladimir Panteleev
wrote:
> writef("%d%%\r", current * 100 / total); stdout.flush();

I'd prolly put a width specifier on it like %3d because otherwise
if it was 100 percent then went to 99, the third digit wouldn't
be erased.
April 27, 2015
On Monday, 27 April 2015 at 02:32:17 UTC, Adam D. Ruppe wrote:
> On Monday, 27 April 2015 at 02:26:01 UTC, Israel wrote:
>> I remember doing this in C++ and it worked but is this possible in D?
>
> Have you tried it yet? The solution is basically the same, you just write out the carriage return character to the device.

You also need to flush the FILE buffer, as C stdio will do that for you only if the string contains a \n character.
April 27, 2015
On Monday, 27 April 2015 at 02:30:36 UTC, Vladimir Panteleev wrote:
> On Monday, 27 April 2015 at 02:26:01 UTC, Israel wrote:
>> I remember doing this in C++ and it worked but is this possible in D?
>>
>> Its basically updating information in the console window without constantly printing new lines.
>>
>> http://stackoverflow.com/questions/14043148/how-to-change-text-while-running-the-console
>
> write(info, "\r"); stdout.flush();
>
> E.g. with percent:
>
> writef("%d%%\r", current * 100 / total); stdout.flush();

Thank you guys it works. Even with the percent sign.

write(sumincrease, "%", "\r"); stdout.flush();