How to update terminal output?

Jack jckj33 at gmail.com
Sun Mar 28 17:55:50 UTC 2021


On Sunday, 28 March 2021 at 16:45:29 UTC, dog2002 wrote:
> I mean, I want to write a string without a new line. For 
> example, some command line applications have progress bars.
>
> For a single line string I use \r. But it doesn't work for a 
> multiple line string - the application is just adding new lines.

you have to erase the line when you're about to display a new 
progress percent. On UNIX system, you have to use character 
terminal escapes[1] on window you have to dig the console API[2] 
or you can just use ncurse library[3][4]

[1]: 
https://web.archive.org/web/20200415203148/http://ascii-table.com/ansi-escape-sequences-vt-100.php
[2]: 
https://docs.microsoft.com/en-us/windows/console/console-reference
[3]: https://invisible-island.net/ncurses/announce.html
[4]: https://code.dlang.org/search?q=ncurses


More information about the Digitalmars-d-learn mailing list