c++ - How to delete a newline using \b -
i want output of following code
-|-2-|-
(when input value of key 2). know \b move cursor 1 space why isn't able move 1 space after newline used input value of key. possible use escape character \b after newline character has been used.
#include<stdio.h> #include<conio.h> int main() { int key; printf("enter value of key: )" printf("-|-"); scanf("%d",&key); printf("\b-|-"); return 0; }
the terminal using output device not have concept of lines of text: knows grid of cells, each of can filled character. 1 of cell positions current cell.
the terminal interprets bs character instruction move current cell 1 one column left. happens if in first column? terminal doesn't know previous line ended, can't go end of line. go last column of row above, , terminals can configured that, that's not want.
this overly simplified, it's why \b
won't delete line break.
Comments
Post a Comment