Path: utzoo!attcan!uunet!wuarchive!udel!mmdf From: CCUCARD%indsvax1.bitnet@uicvm.uic.edu (Paul Cardwell) Newsgroups: comp.sys.amiga Subject: Reading the Keyboard Message-ID: <4734@nigel.udel.EDU> Date: 24 Nov 89 15:56:46 GMT Sender: mmdf@udel.EDU Lines: 54 I was trying to figure out a way to read the keyboard on the Amiga. I figured out how to do it under a CLI window. I was wanting a better one, but here it is: #define ESC 27 main() { int status, win_ptr; char key, buffer[256]; win_ptr = open("RAW:50/50/200/60/Read Keyboard", 0, 0); if(win_ptr != -1) { do { status = read(win_ptr, &key, 1); /* Read from win_ptr and get a char */ sprintf(buffer, "You pressed |%c| Code |%d|\n", key, key); write(win_ptr, buffer, strlen(buffer)); /* Write to Window */ } while (key !=ESC); /* While key is not an ESCape character do... */ close(win_ptr); /* Okay, close window pointed by win_ptr */ } } I was wanting to know how to do it using CUSTOM SCREENS with of course CUSTOM WINDOWS. like : struct NewWindow MyWindow = { 0,0, /* Location of window */ 320,200,3 /* Width..Height..Depth */ ... And the rest of the setup. }; I also create the SCREEN for it too, anyway: if (( Wdw = (struct Window *)OpenWindow(&MyWindow))==NULL) exit(0); /* Failed to open window */ So do I read like: read(MyWindow, &key, 1); ??? I doubt thats correct ??? _____________________________________________________ / //// / / / _ _ //// Paul Cardwell / Amiga / / \\\\//// ccucard@indsvax1 / Rules!!! / / \\//// Indiana State University / / /______\/\/______________________________/___________/