Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: Dumb windows from SAS/C programs on Workbench Message-ID: <1991May20.105246.30915@kuhub.cc.ukans.edu> Date: 20 May 91 15:52:46 GMT References: <1991May17.022136.1539@NCoast.ORG> <1991May20.020743.14630@NCoast.ORG> Organization: University of Kansas Academic Computing Services Lines: 31 With 2.0, you can also hack umain.c to use the autoopen flag of the CON: device, so the window only opens *if* there really is I/O. Another nice thing about 2.0, is you can open _stderr with an autoopen window that also has a wait, so the user (programmer?) gets time to read the message if the file handle is used. This makes things like perror() useful. Another solution is to change UMAIN.c to open NULL: rather than open a window. Note that you must use NULL: rather than NIL: since you need a "real" file handle and handler. Something that works under DOS, or under workbench on the Amiga is: freopen("NULL:", "r+", _stdout); /* etc for _stdin and _stderr */ The program is happy, _stdout goes to NULL: and all works, but the effect of this is to close the file handle passed by Input() if the program is a cli program which is a big no-no. But with Workbench, the filehandle was opened by the startup, and will be closed by the startup quite happily. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~