From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.senn@gmail.com (Will Senn) Date: Tue, 7 Nov 2017 08:59:47 -0600 Subject: [TUHS] Literal character escapes in v7 In-Reply-To: References: Message-ID: <3708707e-43de-4dc6-ebfe-6b8ec1d4a572@gmail.com> > >      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 -------------- next part -------------- An HTML attachment was scrubbed... URL: