/****************************************************************************/ /* */ /* Basic Screen Input/Output Routines for program CR8G */ /* Written By: Kendall Ferguson */ /* */ /* */ /* */ /****************************************************************************/ void BEEP () { int J; printf ("%c", BELL); }; /****************************************************************************/ /* Prompt At screen postion */ /****************************************************************************/ void Prompter (int X_Pos, int Y_Pos, Data_Buffer Str) { gotoxy (X_Pos,Y_Pos); printf ("%s", Str); clreol (); gotoxy (X_Pos,Y_Pos); }; /****************************************************************************/ /* Provide unbuffered keyboard entry */ /****************************************************************************/ char Keyboard_Char () { char ch; /* Character read from key board */ /* Function Keyboard_Char */ ch = getch (); if (isprint(ch)) printf ("%c", ch); return (ch); }; /* Function Keyboard_Char */ /****************************************************************************/ /* Get yes/No from user */ /****************************************************************************/ char Get_YN (int X_pos, int Y_pos, char ch) { int OK; /* True when user's response is Y or N. */ char Answer; /* User's response. */ Data_Buffer tem; /* Function Get_YN */ do /* Until valid response */ { if (ch == 'N') { strcpy (tem, " "); Prompter (X_pos, Y_pos, tem); } else { strcpy (tem, " "); Prompter (X_pos, Y_pos, tem); }; gotoxy (X_pos+1,Y_pos); Answer = toupper (Keyboard_Char ()); if (Answer == CR) Answer = ch; OK = ((Answer == 'N') || (Answer == 'Y')); if (!(OK)) BEEP (); } while (!(OK)); return (Answer); }; /* Function Get_YN */