Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!rphroy!teemc!sycom!ro-chp!chopps From: chopps@ro-chp.UUCP (Chris Hopps) Newsgroups: comp.sys.amiga.programmer Subject: Re: Dumb windows from SAS/C programs on Workbench Message-ID: Date: 17 May 91 15:24:44 GMT References: <1991May14.164909.19186@NCoast.ORG> <1991May17.022136.1539@NCoast.ORG> Organization: CHS Lines: 49 In article <1991May17.022136.1539@NCoast.ORG> davewt@NCoast.ORG (David Wright) writes: >>the net result is that the window disapears. NOTE: I wouldn't advise doing >>anything that uses STDIO/STDOUT if you do this, ie. printf, puts, gets... >>under 1.3 it will definitaley crash! > I would expect this. I don't use ANY of those functions, or any >other I/O functions from lc.lib, only Amiga functions, for which I have >specifically opened a file with "Open()". That's why I don't understand why >they open that window for you. They should just let it alone if you run from >WB, and have people handle it themselves. After all, you have to parse the >WB options differently, anyway. Ah but then what about being able to handle ansi code from workbench(ie. people to lazy to add WB Message handler...) under 1.3 some of this stuff would crash the system if there were no STDIN/OUT. Under 2.0 there is a nice icon that will bring up a cli line and then open a console so that these very same programs can be run under 2.0. But under 1.3 the window was needed, I figure when lattice added this "feature", it was under the assumption that someone who goes out of there way to handle WB messages, and handle IO correctly, won't mind prepending an underscore to there main() to disable such a "feature". > > But the big question now is how do I get to receive CTRL-[CDEF] >interupts? Many people sent me instructions on how to disable the SAS >default CTRL-C handler, and it has indeed allowed my program to ignore >CTRL-C interupts. But what I really want to do is to be able to >check to see if there has been an interupt since the last time I checked, SAS/C Volume II pp. L156-157. onbreak() will setup an interupt handling function for you. then when you call chkabort(), it will check then (and only then) to see if a CTRL-(C|D) has been pressed, if so it calls the interupt function. Now if you return a value that is not zero from this function SAS/C will exit, otherwise it continues from that point. so if you do not want SAS/C to exit just set some global (eek) var. to indicate that a CTRL-(C|D), from your interupt function, then return(0); then have the regular program check the state of the global, if it is true, call your own exit routine, or whatever.... > > Dave Chris... -- ------------------------ The Royal Oak Chophouse Chris Hopps Royal Oak, Michigan ....umich!wsu-cs!ro-chp!chopps cs.wayne.edu!ro-chp!chopps