_mktemp, _wmktemp

De RAD Studio
Aller à : navigation, rechercher

Remonter à Dir.h - Index


Header File

dir.h

Category

Directory Control Routines

Prototype

char *_mktemp(char *template);

wchar_t *_wmktemp(wchar_t *template);

Description

Makes a unique file name.

_mktemp replaces the string pointed to by template with a unique file name and returns template.

template should be a null-terminated string with six trailing Xs. These Xs are replaced with a unique collection of letters plus a period, so that there are two letters, a period, and three suffix letters in the new file name.

Starting with AA.AAA, the new file name is assigned by looking up the name on the disk and avoiding pre-existing names of the same format.

Return Value

If a unique name can be created and template is well formed, _mktemp returns the address of the template string. Otherwise, it returns null.

Example



 #include <dir.h>
 #include <stdio.h>
 int main(void)
 {
     /* fname defines the template for the
       temporary file.  */
     char *fname = "TXXXXXX", *ptr;
     ptr = mktemp(fname);
     printf("%s\n",ptr);
     return 0;
 }



Portability



POSIX Win32 ANSI C ANSI C++

mktemp

+

+

_wmktemp

+