replace tab with ->


/ Published in: C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* replaces tab with -> */
  2. #include <stdio.h>
  3.  
  4.  
  5. int main (int argc, const char * argv[]){
  6. int c;
  7.  
  8. c=getchar();
  9. while(c!=EOF){
  10. if(c=='\t'){
  11. c='-';
  12. putchar(c);
  13. c='\b';
  14. putchar(c);
  15. c='>';
  16. putchar(c);
  17. c=getchar();
  18. }
  19. else if(c=='\b'){ /* funktioniert irgendwie nicht */
  20. c='-';
  21. putchar(c);
  22. c='\b';
  23. putchar(c);
  24. c='<';
  25. putchar(c);
  26. c=getchar();
  27. }
  28. else{
  29. putchar(c);
  30. c=getchar();
  31. }
  32. }
  33. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.