title: How to capture backspace?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4363309/how-to-check-for-the-backspace-character-in-c">how to check for the &ldquo;backspace&rdquo; character in C</a>  </p>
  </blockquote>
  
  
  
  <p>I just want to copy its input to its
  output, replacing each tab by <code>\t</code>, each
  backspace by <code>\b</code>, and each backslash by
  <code>\\</code>. However, i use the similar method
  like replacing each tab by <code>\t</code> cannot
  replacing each backspace by <code>\b</code>.How can
  I capture backspace?</p>
  
  <pre><code>  #include&lt;stdio.h&gt;
      main(){
        int c;
  
  
        char tab='t';
        char bsps='b';
  
        int i;
        int j;
        while((c=getchar())!=EOF)
        { 
  
          if(c == 9)
          { 
              putchar(92);
              putchar(tab);
  
          } 
          else if(c == 8)
          { 
              putchar(92);
              putchar(bsps);
          } 
          else if(c == 92)
          { 
               putchar(92);
                   putchar(92);
          } 
          else putchar(c);
        }
  
      }
  </code></pre>