[TUHS] Literal character escapes in v7
Will Senn
will.senn at gmail.com
Wed Nov 8 00:59:47 AEST 2017
>
> 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: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20171107/b700f995/attachment.html>
More information about the TUHS
mailing list