4 ms·
> CR is a waste for computing... it literally does nothing beneficial CR enables to update a line of text. Print some text without newline at the end, print CR
by Const-me 2y ago
> CR is a waste for computing... it literally does nothing beneficial
CR enables to update a line of text. Print some text without newline at the end, print CR, print another line, and the old text will be overwritten with the new one.
Some command-line apps are using the trick to print progress bars, progress percentage, or similar. This is very beneficial.
- Alupis 2y agoThis is almost always implemented using direct placement of the cursor, not via a literal CR char/command. CR is literally useless, except for being artificially required in some windows text editors.
- Const-me 2y agoCursor placement is hard to do portably because every OS has incompatible ways for that. You gonna need SetConsoleCursorPosition on Windows, and multiple versions of these terminal escape codes on Linux. printf( "\rsomething " ) is much easier.