mmkktteemmpp() -- General Function (libc)

Generate a temporary file name
cchhaarr *mmkktteemmpp(_p_a_t_t_e_r_n) cchhaarr *_p_a_t_t_e_r_n;

mmkktteemmpp() generates  a unique file  name.  It can  be used, for  example, to
name intermediate  data files.  _p_a_t_t_e_r_n  must consist of a  string with six
XX's at the  end.  mmkktteemmpp replaces these XX's with  the five-digit process id
of the requesting process and a  letter that is changed for each subsequent
call.  mmkktteemmpp returns _p_a_t_t_e_r_n. For example, the call

    char template[] = "/tmp/sortXXXXXX";
    mktemp(template);

might return the name /ttmmpp/ssoorrtt0011223344aa.

It is normal practice to write temporary files into the directory /ttmmpp. The
start of the file name identifies the originator of the file.

_S_e_e _A_l_s_o
lliibbcc

_N_o_t_e_s
Because  mmkktteemmpp() writes  on  the argument  template, passing  it a  quoted
string causes a segmentation  violation.  To avoid this, either compile the
module that  contains the call to mmkktteemmpp() with  the compiler option -VVPPSSTTRR
(to  put the  quoted string  into  segment .ddaattaa  rather than  into segment
.tteexxtt) or, preferably, move the string into the data segment.  For example,
use

    char template[] = "/tmp/sortXXXXXX";
    mktemp(template);

rather than:

    mktemp("/tmp/sortXXXXXX");
