Not being able to get backspace character (\b) in the output on ubuntu (K&R example)

c, kernighan-and-ritchie, ubuntu

Solution

Run the program and enter CtrlH.

The key-code send by the backspace key (also: <---) is most probably eaten by the shell. This depends on how the terminal is configured. Read here for details: http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html

Problem

``` #include <stdio.h> /* replacing tabs and backspaces with visible characters */ int main() { int c; while ( (c = getchar() ) != EOF) { if ( c == '\t') printf("\\t"); else if ( c == '\b') printf("\\b"); else if ( c == '\\') printf("\\\\"); else putchar(c); } return 0; } ``` Now my question is .. Why can't I see "\b" in the output ? I have written this code in Ubuntu terminal. Is there any other way to get the "\b" character in output ? If there is , please explain in simple words as I have just started learning C programming.This example is from K&R exercise 1-10.

Original source