Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ucla-cs!zen!ucbvax!CITHEX.CALTECH.EDU!carl From: carl@CITHEX.CALTECH.EDU (Carl J Lydick) Newsgroups: comp.os.vms Subject: Re: VMS C SYS$OUTPUT Message-ID: <870912025526.02e@CitHex.Caltech.Edu> Date: Sat, 12-Sep-87 06:01:44 EDT Article-I.D.: CitHex.870912025526.02e Posted: Sat Sep 12 06:01:44 1987 Date-Received: Sun, 13-Sep-87 09:38:22 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 25 > I have been using VAX C version 2.3 to write a program designed to be run > as a detached process. It runs fine, but VAX C insists on opening > SYS$OUTPUT and SYS$ERROR even though the program does not do any output. > There are no Output functions used in the program and when I run it /detached > it creates files called SYS$OUTPUT. and SYS$ERROR. Is there a way around > this? Is main() doing this? I can close the files with fclose(stdout) and > fclose(stderr) but that still leaves me with useless files in my directory. Well, yes and no. In order to achieve at least partial compatibility with that other operating system (U*IX. to avoid a footnote) the VAX C compiler likes to have the three U*IX standard files open. It does this in the following way: If it sees a routine called "main" as the first routine in a module it compiles, it has "main" call "C$MAIN" before it does anythhing else. C$MAIN takes care of parsing the command line and opening the standard files.; > So it seems that stdout and stderr are opened by default (which makes sense > for interactive processes, but I need to find a way to prevent them from > being opened. As you may have gathered from the above, the way to avoid this unfortunate (in a few cases; one that comes immediately to mind is a print symbiont) state of affairs, just don't have a "main" routine. Bear in mind that this also means you've got to parse the command line yourself.