File tmpname.icn

Summary

###########################################################################

       File:     tmpname.icn

       Subject:  Procedure to get temporary file name

       Author:   Richard L. Goerwitz

       Date:     February 11, 1995

###########################################################################

   This file is in the public domain.

###########################################################################

       Version:  1.5

###########################################################################

  Need to open up a temporary file?  This procedure prevents you from
  clobbering existing files by giving you a unique temp file name.
  Note that tempname() does not return an open file.  It merely returns
  a string.  The user is responsible for open()'ing a file by that
  name, and for removing it when done.

  Note that tempname() is a generator, suspending upto 999 unique
  (and MS-DOS compatible) filenames.

  Bug:  Icon has no exists() call, so the only way we can tell if a
  filename is already in use is to try to open it for reading.  On
  most systems, inability to read a file by a given name does not
  necessarily indicate that the filename is not in use.  Hence this
  procedure may, under very, very rare circumstances, return the
  name of a file already in use.  We're safe, though, since if this
  ever happens to anyone (which I doubt), no files will get clob-
  bered.  One workaround for the problem is to call tempname() with-
  out using any intermediate variables, so that it is resumed until
  some open function succeeds (e.g. open(tempname())).

###########################################################################

  History:

  25 Mar 94 - D. Gamey - changes to use DOS temp directory and .tmp names
  20 Feb 95 - R. Griswold - changed to use of exists()
 
###########################################################################

  Requires:  UNIX, MS-DOS or another congenial operating system

###########################################################################

  See also:  tempfile() in io.icn

###########################################################################

  Links:  io

###########################################################################
Procedures:
tempname, tempname_default, tempname_ext

Links:
io.icn

This file is part of the (main) package.

Source code.

Details
Procedures:

tempname()


tempname_default()


tempname_ext()



This page produced by UniDoc on 2021/04/15 @ 23:59:54.