#include <stdio.h>
/* replace tabs and backspaces with visible characters */
main()
{
int c;
while ((c = getchar()) != EOF) {
if (c == '\t')
printf("\\t");
if (c == '\b')
printf("\\b");
if (c == '\\')
printf("\\\\");
if (c != '\b')
if (c != '\t')
if (c != '\\')
putchar(c);
}
}
Why was I not able to see \b backspace signature when I press the backspace?
You need to learn about else, that if-ladder is pretty scary.
And your terminal probably doesn't send a single backspace character, it can be a bit complicated how actual terminal programs represent that kind of "special" key (delete is another favorite).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With