Encoders
Hub for Computer Whizzes Register to join us

Encoders > More... > C > Program

/* Program to copy its input to its output, replacing each tab by \t,
each backspace by \b and each backslash by \\. This makes tabs and backspaces
visible in an unambiguos way. */

#include <stdio.h>

main()
{
	int c;
	while((c=getchar())!=EOF)
		if(c=='\t')
			printf("\\t");
		else if(c=='\b')
			printf("\\b");
		else if(c=='\\')
			printf("\\\\");
		else
			putchar(c);
	printf("\n");
}