limb 0.2.0

2024-01-09

open_tmp(3)
limb manual
open_tmp(3)

NAME

open_tmp - open a new temporary file

SYNOPSIS

#include <limb/djbunix.h>
int open_tmp(char *name)

DESCRIPTION

The open_tmp() function opens a new temporary file for writing, using a name based on the template pointed by name - which must end with at least 6 characters X that will be replaced with random (printable) characters.

The memory pointed by name will be modified, replacing the trailing X characters so that name contains the name of the file actually opened.

Note

It is actually implemented as a macro to mkfiletemp(3).

RETURN VALUE

The open_tmp() function returns the opened file descriptor on success. Otherwise it returns -1 and sets errno to indicate the error.

ERRORS

The open_tmp() function may fail if :

EINVAL

The template pointed by name does not end with at least 6 X.

It may also fail and set errno for the errors described for open_excl(3).

limb 0.1.0
2023-07-24
open_tmp(3)