>>977
問題文の意味がよくわからんけど、getch() は使って良かったのかな?

#include <stdio.h>
#include <conio.h>
#define CTRL_D 0x04
#define CTRL_Z 0x1A
#define RETURN 0x0D
int main(void){
    int c;

    while(1){
        c = getch();
        if(c == CTRL_D || c == CTRL_Z) break;

        switch(c){
            case '\t': printf("\\t"); break;
            case '\b': printf("\\b"); break;
            case '\\': printf("\\\\"); break;
            case RETURN: printf("\n"); break;
            default: printf("%c", c);break;
        }
    }
    return 0;
}