~ubuntu-branches/ubuntu/precise/manpages-posix/precise

1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
1
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
2 by Francesco Paolo Lovergine
* Alligned to linux main manpages edition.
2
.TH "MKTEMP" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
3
.\" mktemp 
4
.SH NAME
5
mktemp \- make a unique filename (\fBLEGACY\fP)
6
.SH SYNOPSIS
7
.LP
8
\fB#include <stdlib.h>
9
.br
10
.sp
11
char *mktemp(char *\fP\fItemplate\fP\fB); \fP
12
\fB
13
.br
14
\fP
15
.SH DESCRIPTION
16
.LP
17
The \fImktemp\fP() function shall replace the contents of the string
18
pointed to by \fItemplate\fP by a unique filename and
19
return \fItemplate\fP. The application shall initialize \fItemplate\fP
20
to be a filename with six trailing \fB'X'\fP s;
21
\fImktemp\fP() shall replace each \fB'X'\fP with a single byte character
22
from the portable filename character set.
23
.SH RETURN VALUE
24
.LP
25
The \fImktemp\fP() function shall return the pointer \fItemplate\fP.
26
If a unique name cannot be created, \fItemplate\fP shall
27
point to a null string.
28
.SH ERRORS
29
.LP
30
No errors are defined.
31
.LP
32
\fIThe following sections are informative.\fP
33
.SH EXAMPLES
34
.SS Generating a Filename
35
.LP
36
The following example replaces the contents of the \fB"template"\fP
37
string with a 10-character filename beginning with the
38
characters \fB"file"\fP and returns a pointer to the \fB"template"\fP
39
string that contains the new filename.
40
.sp
41
.RS
42
.nf
43
44
\fB#include <stdlib.h>
45
\&...
46
char *template = "/tmp/fileXXXXXX";
47
char *ptr;
48
.sp
49
50
ptr = mktemp(template);
51
\fP
52
.fi
53
.RE
54
.SH APPLICATION USAGE
55
.LP
56
Between the time a pathname is created and the file opened, it is
57
possible for some other process to create a file with the same
58
name. The \fImkstemp\fP() function avoids this problem and is preferred
59
over this
60
function.
61
.SH RATIONALE
62
.LP
63
None.
64
.SH FUTURE DIRECTIONS
65
.LP
66
This function may be withdrawn in a future version.
67
.SH SEE ALSO
68
.LP
69
\fImkstemp\fP() , \fItmpfile\fP() , \fItmpnam\fP() , the Base Definitions
70
volume of IEEE\ Std\ 1003.1-2001, \fI<stdlib.h>\fP
71
.SH COPYRIGHT
72
Portions of this text are reprinted and reproduced in electronic form
73
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
74
-- Portable Operating System Interface (POSIX), The Open Group Base
75
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
76
Electrical and Electronics Engineers, Inc and The Open Group. In the
77
event of any discrepancy between this version and the original IEEE and
78
The Open Group Standard, the original IEEE and The Open Group Standard
79
is the referee document. The original Standard can be obtained online at
80
http://www.opengroup.org/unix/online.html .