Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!samsung!crackers!m2c!risky.ecs.umass.edu!dime!delux2!robinson From: robinson@delux2.cs.umass.edu (Richard Robinson) Newsgroups: comp.sys.amiga.programmer Subject: Re: Consoles & RastPorts, and ne'er the twain shall meet Keywords: stdio Message-ID: <30094@dime.cs.umass.edu> Date: 5 May 91 15:53:34 GMT References: <1991Apr29.221442.14665@bilver.uucp> Sender: news@dime.cs.umass.edu Reply-To: robinson@elux1.CS.UMASS.EDU (Richard Robinson) Distribution: na Organization: University of Massachusetts, Amherst Lines: 38 In article <1991Apr29.221442.14665@bilver.uucp> alex@bilver.uucp (Alex Matulich) writes: >Here are two Amiga programming problems that I would like to be able to >solve, without resorting to assembly language if possible. I need a >solution to just one of them, number 2 preferably! > >(1) I open a window using fopen("CON:", "wb"). A console window is >opened, and a convenient file pointer is returned which I can use with >functions like fprint(), fputs(), etc. Problem: How do I find a pointer >to this window's Window structure, specifically the pointer to its RastPort? > >(2) I open a window using OpenWindow(), and a pointer to the Window >structure is returned. I attach a console to this window using >OpenConsole(). Problem: How do I get an fopen-compatible stdio pointer >to the console, so that I can use fprint() with it? An easy way to solve this is to use ConMan. It has an option to open a standard console (so you can use fopen/fread/fetc on it) on a pre-existing window. > >It seems to me, that if I can do (1) or (2) separately, there should be a >way to combine the benifits of both. Can anybody help? > >Also, if anybody can explain how the AmigaDOS "More" program is able to >intercept keystrokes from the CLI console before the CLI gets to them >(without resorting to assembly if possible), you'd have my undying >gratitude! This one is easy. Just send a packet to the console turning it to RAW mode. I have a code fragment which I can post if you want. (I can't send mail, so if someone else can, maybe we won't have to waste bandwidth.) However, I can receive mail, and if several people would like the code, I'll post (send me mail). -Dread -- robinson@elux1.cs.umass.edu