mohammad reza_1 30 Newbie Poster

here is a code to read an array of characters until user press CTRL+C

void read_ctrl_z(char *x){
    int i = 0;
    while (true) {
        x[i++] = getch();
        if(x[i-1] == 26) {
            x[i-1] = '\0';
            cout<<endl;
            break;
        }else{
            cout<<x[i-1];
        }
    }
}
rproffitt commented: Why 11 years late? -4
Dani commented: It could still be useful to someone. +34