#include #include #include main() { char text_output[26]; short term_char; int _3 = 3, _7 = 7, _9 = 9, _24 = 24, _60 = 60, border = SMG$M_BORDER; int display,paste,keyboard; DESCRIPTOR strdes; /* Create the virtual display with a border. */ smg$create_virtual_display(&_7,&_60,&display,&border); /* Create the pasteboard. */ smg$create_pasteboard(&paste); /* Create a virtual keyboard. */ smg$create_virtual_keyboard(&keyboard); /* Paste the virtual display at row 3, column 9. */ smg$paste_virtual_display(&display,&paste,&_3,&_9); $DESCRIPTOR_I(strdes, "Enter the character after the >> prompt."); smg$put_line(&display,&strdes); $DESCRIPTOR_F(strdes, "The character you type will not be echoed."); smg$put_line(&display,&strdes); $DESCRIPTOR_F(strdes, "The character equivalent of K is displayed."); smg$put_line(&display,&strdes); strdes.length=0; smg$put_line(&display,&strdes); /* Read a key stroke from the virtual keyboard. */ $DESCRIPTOR_F(strdes, ">>"); smg$read_keystroke(&keyboard,&term_char,&strdes,NULL,&display); strdes.length=0; smg$put_line(&display,&strdes); /* Convert the value of term_char to a decimal ASCII string. */ $DESCRIPTOR_L(strdes, text_output,\ decode(text_output,26,"Terminal character is: %- 3us",term_char)); /* Print the decimal ASCII text string. */ smg$put_line(&display,&strdes); /* Print the decimal ASCII string again another way. */ $DESCRIPTOR_L(strdes, &text_output[23], 3); smg$put_chars(&display,&strdes,&_7,&_24); exit(); }