digitalmars.D.learn - How to change text while running in console?
- Israel (5/5) Apr 26 2015 I remember doing this in C++ and it worked but is this possible
- Vladimir Panteleev (4/9) Apr 26 2015 write(info, "\r"); stdout.flush();
- Adam D. Ruppe (5/6) Apr 26 2015 I'd prolly put a width specifier on it like %3d because otherwise
- Israel (4/15) Apr 26 2015 Thank you guys it works. Even with the percent sign.
- Adam D. Ruppe (3/5) Apr 26 2015 Have you tried it yet? The solution is basically the same, you
- Vladimir Panteleev (3/8) Apr 26 2015 You also need to flush the FILE buffer, as C stdio will do that
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
Apr 26 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-consolewrite(info, "\r"); stdout.flush(); E.g. with percent: writef("%d%%\r", current * 100 / total); stdout.flush();
Apr 26 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.
Apr 26 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:Thank you guys it works. Even with the percent sign. write(sumincrease, "%", "\r"); stdout.flush();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-consolewrite(info, "\r"); stdout.flush(); E.g. with percent: writef("%d%%\r", current * 100 / total); stdout.flush();
Apr 26 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.
Apr 26 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:You also need to flush the FILE buffer, as C stdio will do that for you only if the string contains a \n character.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.
Apr 26 2015