if (keyboard_init()) { fprintf(stderr,<\n> "\nCould not initialize keyboard.\n"); exit(1); } /* first check for input, then handle it */ while (kbhit()) switch (getkey()) { case K_Down: { printf("\nYou pressed the DOWN key"); break; } case K_Up: { printf("\nYou pressed the UP key"); break; } } /* * Predefined constants such as K_Down and * K_Up may be found in DJGPP's `keys.h'<\n> * include file. */ /* first check for input, then handle it */ keyboard_update(); if (keyboard_keypressed(SCANCODE_CURSORUP)) printf("\nYou pressed the UP key"); if (keyboard_keypressed(SCANCODE_CURSORDOWN)) printf("\nYou pressed the DOWN key"); /* * Predefined constants such as * SCANCODE_CURSORUP and SCANCODE_CURSORDOWN * may be found in SVGALIB's vgakeyboard.h * include file. */