Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!gatech!mcnc!ece-csc!rss From: rss@ece-csc.UUCP (Ralph Scherp) Newsgroups: comp.sys.amiga.tech Subject: How do I enable instant IO on console window Message-ID: <3630@ece-csc.UUCP> Date: 1 Jun 88 21:07:41 GMT Reply-To: rss@ece-csc.UUCP (Mark Lanzo) Organization: . Lines: 64 Got a question which should be simple for all you Amiga wizards out there... How can I disable buffering on a console window so that functions like "getchar()" return key-strokes as keys are pressed, rather than after the user hits the RETURN key? Ideally, I'd like to be able to just switch the window from normal "cooked" mode input into "raw" input, and use the stdio functions. If absolutely necessary, a routine to the effect of "GetKey()" which waited for a keypress and then returned the character would be acceptible. I've tried to put such a GetKey() routine together, trying various tacks varying from "setnbf(stdin)" to direct communication with the console.device; but all I've been able to accomplish in any circumstance is the generation of the dreaded "Software Error" requester. My attempts to communicate with "console.device" have failed mostly due to lack of documentation about how to accomplish things with the machine. I have the RKM, but it's an almost completely useless mess, being woefully incomplete & poorly indexed (even with the autodocs, unfortunately). Can any of you provide answers to a few questions: 1. How can I obtain a pointer to my console window? In order to `OpenDevice("console.device")', I need to pass the address of the window via the io_Data field of the IOStdReq structure. However, since I don't HAVE that information available... 2. How can I obtain a pointer to my current "Process" structure? Does "FindTask(0)" actually return a pointer to my "Process" structure if the program is a "Process" rather than a "Task"? [From looking at Lattice's _main.c; I got the impression that this was the case]. 3. What are the fields in the Process structure? Nowhere that I could find in the RKM (not even in the DOS Developer's Manual, which discusses CreateProc() and related calls) is the Process structure discussed. I made a guess as to the meanings of the fields from looking at the file "libraries/dosextens.h" but apparently guessed wrong. In case you're wondering; I tried to get a pointer to the current window by a stunt like: process = (struct Process *) FindTask(0); CurWin = (struct Window *) process->pr_WindowPtr in an attempt to use "CurWin" as the window pointer in a call to OpenDevice with "console.device", but all I got was a Guru on the call to OpenDevice. 4. Since one can normally communicate with a console window, it seems logical to assume that the console.device is already attached to to the window, so trying to open it again is a bit silly. If I knew how to get to the current console.device; I'd try implementing the aforementioned GetKey() routine by issuing a DoIO() call using CMD_READ and io_Length set to 1 [Would this work?]. Again, this seems like something that might be found in the Process structure, but... Well, enough questions for one posting. I'd really appreciate any help you can provide for me. Thanks in advance, Mark Lanzo via ...ece-csc!rss