/************************************************************************** SCRHAND.C *************************************************************************** This example uses screen handling functions and ungetch to switch to the console screen and stuff the console keyboard to load an NLM (in this example, MONITOR.NLM is loaded). **************************************************************************/ #include <nwconio.h> #include <stdio.h> int main(int argc, char *argv[]) { int i = 0; /* '\r' carriage return on the console command line */ char string[] = "\rLOAD SYS:SYSTEM\\MONITOR.NLM\r"; int screenHandle; /* Create a screen handle for the console screen, even though the console screen exists. */ if ((screenHandle = CreateScreen("System Console", 0)) == NULL) { printf("The console screenHandle is bad\n"); return(1); } SetCurrentScreen(screenHandle); /* switch to console screen I/O */ /* Load MONITOR.NLM */ while (string[i] != 0) { /* Stuff the console keyboard */ ungetch(string[i++]); } return(0); }