www.delorie.com/djgpp/doc/libc/libc_573.html   search  
libc.a reference

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

mkstemp

Syntax

 
#include <stdio.h>

int mkstemp(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. It then creates and opens the file in a way which guarantees that no other process can access this 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.

Note also that the path you give will be modified in place.

Return Value

The open file descriptor.

Portability

ANSI/ISO C No
POSIX No

Example

 
char path[100];
strcpy(path, "/tmp/ccXXXXXX");
int fd = mkstemp(path);


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004