I am doing the exercises in "The C Programming Language" The following program works, except for the backspace '\b'. Can someone help me to get this to work. Using the shell in windows xp to run the program. I tried using the del key ascii code also but it does not work.
Please ignore the use of the if statements, it's temporary. for some reason the console simply does not recognize \b backspace.
#include <stdio.h>
Code:main() { int c, d, bs; bs = 0; while((c = getchar()) != EOF) { d = 0; if(c == '\t') { putchar('\\'); putchar('t'); d = 1; } if(c == '\b') { putchar('\\'); putchar('b'); d = 1; bs++; } if(c == '\\') { putchar('\\'); putchar('\\'); d = 1; } if(d == 0) { putchar(c); } } printf("Backspace: %d", bs); }