delorie.com/djgpp/doc/libc/libc_574.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

mktemp

Syntax

 
#include <stdio.h>

char *mktemp(char *template);

Description

template is a file specification that ends with six trailing X characters. This function replaces the XXXXXX with a set of characters such that the resulting file name names a nonexisting file.

Note that since MS-DOS is limited to eight characters for the file name, and since none of the X's get replaced by a dot, you can only have two additional characters before the X's.

Return Value

If a unique name cannot be chosen, NULL is returned. Otherwise the resulting filename is returned.

Portability

ANSI/ISO C No
POSIX No

Example

 
char template[] = "/tmp/ccXXXXXX";
if (mktemp(template) != NULL)
  {
    FILE *q = fopen(template, "w");
    ...
  }


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004