*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> mktemp (3c)              
Title
Content
Arch
Section
 

Contents


MKTEMP(3C)							    MKTEMP(3C)


NAME    [Toc]    [Back]

     mktemp, mkstemp - make a unique file name

SYNOPSIS    [Toc]    [Back]

     #include <stdio.h>

     char *mktemp (char	*template);

     int mkstemp(char *template);

DESCRIPTION    [Toc]    [Back]

     Mktemp replaces the contents of the string	pointed	to by template by a
     unique file name, and returns the address of template.  The string	in
     template should look like a file name with	six trailing Xs; mktemp	will
     replace the Xs with a string that can be used to create a unique file
     name.

     Mkstemp makes the same replacement	to the template	but returns a file
     descriptor	for the	template file open for reading and writing.  Mkstemp
     avoids the	race between testing whether the file exists and opening it
     for use.

     The mkstemp routine is from the 4.3BSD standard C library.

SEE ALSO    [Toc]    [Back]

      
      
     getpid(2),	tmpfile(3S), tmpnam(3S).

DIAGNOSTICS    [Toc]    [Back]

     Mktemp will assign	a zero to the first character of template if it	cannot
     create a unique name, returning the empty string.

     Mkstemp returns an	open file descriptor upon success.  It returns -1 if
     no	suitable file could be created.

CAVEAT    [Toc]    [Back]

     Mktemp makes 26 attempts to generate a filename which is not currently in
     use from a	given template.	 Since the filename generated uses the process
     ID	as a base, it is highly	unlikely that these names will conflict	with
     those generated by	another	process.  Variation in the contents of the
     actual string given to mktemp, as well as the number of times mktemp is
     called, will determine the	likelihood of successfully generating a	unique
     name.


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
mktemp FreeBSD make temporary file name (unique)
mkdtemp OpenBSD make temporary file name (unique)
mkdtemp FreeBSD make temporary file name (unique)
mkstemp OpenBSD make temporary file name (unique)
mkstemps OpenBSD make temporary file name (unique)
mkstemp FreeBSD make temporary file name (unique)
mkstemps FreeBSD make temporary file name (unique)
mktemp OpenBSD make temporary file name (unique)
mktemp Linux make a unique temporary file name
mktemp FreeBSD make temporary file name (unique)
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service