Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!mchinni@ardec.arpa From: mchinni@ardec.arpa (Michael J. Chinni, SMCAR-CCS-E) Newsgroups: comp.unix.wizards Subject: Re: Writing to A NON-Existing File in \"C\" Message-ID: <12840@brl-adm.ARPA> Date: 6 Apr 88 19:32:06 GMT Sender: news@brl-adm.ARPA Lines: 28 In a message from Michael Deutsch dated 6 Apr 88 03:47:17 GMT he writes: > I have a "C" program that records the program > results into a file, provided that file already > exists. In case the file DOES NOT exist I want > the program to function identically but the results > should be flushed down the tube, i.e. nowhere, i.e. > written to a non-existing file? > > What sort of "file pointer" or trick should I use > to accomplish my goal? I have a couple of suggestions. First, try writing to "/dev/null". Second, a temporary file could be used ("mkstemp" in BSD or "tmpnam"/"tempnam" and "tmpfile" in SysV). Last, a filename of personal choice could be created, written to, and then deleted at the end of the program. Mike Chinni US Army Armament Research, Development, and Engineering Center Picatinny Arsenal, New Jersey 07806-5000 AUTOVON: 880-4140 MILNET: COMMERCIAL: (201) 724-4140 ------ Standard Disclaimer ------