| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- make a unique file name from a template and open the file
#include <stdlib.h>intmkstemp(char *template);
intmkstemps(char *template,intslen);
char *mkdtemp(char *template);
Themkstemp() function replaces the contents of the string pointed to bytemplate by a unique file name, and returns a file descriptor forthe file open for reading and writing. The function thus prevents anypossible race condition between testing whether the file exists and opening it foruse. The string intemplate should look like a file name withsix trailing 'X's;mkstemp() replaces each 'X' with a character from theportable file name character set. The characters are chosen such that the resultingname does not duplicate the name of an existing file.
Themkstemps() function behaves the same asmkstemp(), except it permits asuffix to exist in the template. The template should be of theform /tmp/tmpXXXXXXsuffix. Theslen parameter specifies the length of the suffix string.
Themkdtemp() function makes the same replacement to the template as inmktemp(3C) and creates the template directory usingmkdir(2), passing amode argumentof 0700.
Upon successful completion,mkstemp() returns an open file descriptor. Otherwise -1 isreturned if no suitable file could be created.
Themkstemp(),mkstemps(), andmkdtemp() functions can seterrno to the samevalues aslstat(2).
Themkstemp() andmkstemps() functions can seterrno to the same valuesasopen(2).
Themkdtemp() function can seterrno to the same values asmkdir(2).
It is possible to run out of letters.
Themkstemp() function does not check to determine whether the file namepart oftemplate exceeds the maximum allowable file name length.
Thetmpfile(3C) function is preferred over this function.
Themkstemp() function is frequently used to create a temporary file thatwill be removed by the application before the application terminates.
Themkstemp() function has a transitional interface for 64-bit file offsets. Seelf64(5).
Seeattributes(5) for descriptions of the following attributes:
|
getpid(2),lstat(2),mkdir(2),open(2),tmpfile(3C),mktemp(3C),attributes(5),lf64(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |