Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. int bio_flag(const char* format, int row, int col, int* status, int radio){
  2.   int done = 0;
  3.   int key = -1;
  4.   if (status) /* if status is non zero set to 1 */
  5.     *status = !!(*status);
  6.   while(!done) {
  7.     bio_displayflag(format, row, col, *status);
  8.     key = bio_getch();
  9.     if (key > SPACE_KEY && key <= TILDA_KEY) bio_beep(); /* if key is any printable key, beep */
  10.     else if (key >= F1_KEY && key <= F12_KEY) done = 1; /* if any function key is pressed, terminate the function */
  11.     else if (key == SPACE_KEY) {
  12.       if (radio)
  13.         *status = 1;
  14.       else
  15.         *status = !(*status); /* toggle status between 0 and 1 */
  16.       done = 1;
  17.     }
  18.     bio_displayflag(format, row, col, *status);
  19.   }
  20.   return key;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement