Temporary file.

Synopsis

Declared in <folly/testing/TestUtil.h>

class TemporaryFile;

Description

By default, the file is created in a system‐specific location (the value of the TMPDIR environment variable, or /tmp), but you can override that with a different (non‐empty) directory passed to the constructor.

By default, the file is closed and deleted when the TemporaryFile object is destroyed, but both these behaviors can be overridden with arguments to the constructor.

Enums

Name

Description

Scope

Controls when the temporary file is unlinked.

Member Functions

Name

Description

TemporaryFile [constructor]

Constructors

~TemporaryFile [destructor]

Destroys the object, closing and unlinking the file per the chosen scope.

operator=

Move‐assigns from another instance.

close

Closes the underlying file descriptor.

fd

Returns the underlying file descriptor.

path

Returns the path of the temporary file.

reset

Closes and unlinks the file, releasing its resources.

Created with MrDocs