I'm fairly new to C and was working on a program to remove comments
from C code (just an exercise). This uses a while((getchar())!=EOF)
loop to read characters. Basically when it sees a character inside a
comment, I am using putchar('\b'); putchar(' '); to remove the
character. When I physically type in each line from the keyboard, it
works fine. However if I do it this way:
program < input.c > output_file
I get ^H instead of \b (even though stty erase is set to ^?). The
backspace key works fine otherwise. Is there something else I'm
missing? The strange part is that it works exactly the same was in
DOS. I know it's because of the I/O redirection from files but I'm
not sure why. Any clues would be very much appreciated!
I did a Dejanews search but all I could find where problems with
people not having their backspace key set correctly.
I don't think it makes any difference but I'm using Debian Linux.
David