int main() { int choice=0; FILE * input;FILE * output; if(!isatty(fileno(stdout))) { fprintf(stderr,"You are not a terminal,OK,\n"); } input=fopen("/dev/tty","r"); output=fopen("/dev/tty","w"); if(!input||!output) { fprintf(stderr,"Unable to open /dev/tty\n"); exit(1); } do{ choice=getchoice("Please select a action",menu,input,output); fprintf(output,"You have chosen: %c\n",choice); }while(choice!=''''q''''); exit(0);