Path: utzoo!mnetor!uunet!husc6!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ames!pacbell!att-ih!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: comp.lang.fortran Subject: Re: I would like to have an argumen Message-ID: <2232@ttrdc.UUCP> Date: 11 Mar 88 18:14:33 GMT References: <720@cresswell.quintus.UUCP> <68000011@convex> Organization: AT&T, Skokie, IL Lines: 41 In article <68000011@convex>, hutchson@convex.UUCP writes: > I work on unix now, and I miss temporary files. Yes, I know about mktemp: > it doesn't work at all well, and I wrote a better one for my own uses. But > there is no such thing on unix as a temporary file that steals SWIFTLY and > silently away as soon as the job finishes executing. This is not a feature; > this is a severe limitation! It is not possible to simulate temporary files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > on unix without great effort; it is a pain even to pretend to simulate it. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I'd challenge that. Files which are open when they are unlinked stick around until the process that opened them terminates. What's so hard about: char *tmpfnam = mktemp("/tmp/XXXXXX"); int fd = creat(tmpfnam,MODE); unlink (tmpfnam); /* You can still scribble in the temp file, * and read it, via the file descriptor. * It goes away when the process terminates. */ or in f77 character*16 tmpnam open (unit=1,status='scratch') inquire (unit=1, name=tmpnam) open (unit=2,file=tmpnam,status='old') close (unit=2, status='delete') C or for the two lines immediately above, substitute C C call system('rm -f '//tmpnam) C C now you can access your scratch file through logical unit 1 C and even if the program dies abnormally, the scratch file goes C away -- |------------Dan Levy------------| Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, | an Engihacker @ | }!ttrdc!ttrda!levy | AT&T Computer Systems Division | Disclaimer? Huh? What disclaimer??? |--------Skokie, Illinois--------|