while((c = getchar()) != EOF) {
         if(c == '\t')
             printf("\\t");
          if(c == '\b')

Shouldn't this be 'else if'? Otherwise, if you encounter a tab, you will print '\t' and then call into the 'else' below after the test for '\b' and print c, which is a tab literal.

        - Dan C.


Yes it should - I was concentrating on the backspace thing and not being careful enough about the code.

       if(c== '\t')
           printf("\\t");
       else if(c == '\b')
           printf("\\b");
       else
           putchar(c);

Thanks,
Will