Path: utzoo!mnetor!uunet!husc6!mailrus!ames!oliveb!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: Getting a file handle for a non-cli window Message-ID: <51947@sun.uucp> Date: 4 May 88 16:41:55 GMT References: <2370@louie.udel.EDU> Sender: news@sun.uucp Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 39 In article <2370@louie.udel.EDU> rminnich@udel.EDU (Ron Minnich) writes: >1) WHy do i want to do this? > Cause all the io, in lattice and manx, is in terms of file handles. > I just don't LIKE the console.device nonsense. >ron (rminnich@udel.edu) Ron has been sending these out for a bit and while I thought the answer was fairly clear I suspect it is not. The 'simple' answer is to put a window pointer into the startup message of the console device when starting it, and then jamming that value into a file handle at the appropriate place. Basically, there are three things we are dealing with here : CON: - can be opened and accessed with read(3), and write(3), as well as the stdio library. Limited to opening windows on the WORKBENCH screen. console.device - can be opened with the AmigaDOS Open(2) call and accessed with SendIO(2) and DoIO(2), etc. Normally limited to the WORKBENCH but some tricks can be used (described in AmigaMail) to make it open on a different screen. Window - Can be opened with OpenWindow() and written to using the Text() call. This is what vt100 does, the extremely patient person could possibly turn the VT100 program into a library routine for opening 'terminal' windows. The problem with the solution above is the 'jamming' part. There is no officially sanctioned way to create a filehandle out of an open file descriptor. About the only think I can think of would be to open a CON: window, using the ACTION_INFO packet get a pointer to the ConUnit structure, put in the parameters from your opened console.device, and then send it an esc-c to get it to re-sync. Not pretty and not easy either. (Nor is it likely to work in future versions of the OS). My real suggestion is to put some wrappers around the calls to the console device to make them more usable, or rethink the problem. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.