Home
Highly Reusable Software By activity User Interface Text Strings Math Processing
Stored Data
Communications
Hard World File System
|
#License - #Source code - #Example Use -
#include <librock/file.h> int librock_mkstemp( char *pszTemplate);
This uses mktemp() and open() correctly to avoid a race condition. (If you do not need the name, consider using tmpfile() instead.)
pszTemplate should end with 'XXXXXX'. It is modified to be the filename on successful return.
IMPORTANT: Be sure to strcpy a new template with each call. (Follow the example below.)
Typical use is
char buf[20]; strcpy(buf,"aaXXXXXX"); fd = mkstemp(buf); if (fd < 0) { /* Error! */ }
mktemp() open() malloc() free() strcpy() strlen()
Copyright 1998-2002 Forrest J. Cavalier III, http://www.mibsoftware.com Licensed under BSD-ish license, NO WARRANTY. Copies must retain this block. License text in <librock/license/librock.txt> librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45
Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)
Want to help? We welcome comments, patches. -- Need help? Request paid support.