Util--  1.1
Public Member Functions | Static Public Member Functions | List of all members
utilmm::tempfile Class Reference

#include <utilmm/system/system.hh>

Inheritance diagram for utilmm::tempfile:
Inheritance graph
[legend]
Collaboration diagram for utilmm::tempfile:
Collaboration graph
[legend]

Public Member Functions

 tempfile ()
 
 ~tempfile ()
 
 tempfile (std::string const &basename)
 
FILE * detach ()
 
boost::filesystem::path path () const
 
FILE * handle () const
 

Static Public Member Functions

static FILE * mkstemp (std::string const &base, boost::filesystem::path &path)
 
static FILE * create ()
 

Detailed Description

A temporary file. It is created on construction and removed on destruction

Constructor & Destructor Documentation

utilmm::tempfile::tempfile ( )

Create a temporary file. If you use this constructor, you cannot have the file name. You'll have to use only the file handle.

Exceptions
unix_error
utilmm::tempfile::~tempfile ( )

Close and destroy the file

utilmm::tempfile::tempfile ( std::string const &  basename)

Create a temporary file using a base name The file name is available using path()

The tempfile() version is more secure. Use only this constructor if you need the file path

Member Function Documentation

static FILE* utilmm::tempfile::create ( )
static

Creates a temporary file

Returns
the file descriptor to the open file
Exceptions
unix_erroran error occured
FILE* utilmm::tempfile::detach ( )

Disassociates this object from the temporary file After a call to disassociate(), path() and fd() are no longer available

Returns
the file path
FILE* utilmm::tempfile::handle ( ) const

Get the underlying file handle

static FILE* utilmm::tempfile::mkstemp ( std::string const &  base,
boost::filesystem::path &  path 
)
static

Wrapper around mkstemp Do not use this function to create a temporary file Use a tempfile object instead

boost::filesystem::path utilmm::tempfile::path ( ) const

Get the file path The file path is only available if the tempfile(std::string) constructor has been used.

Returns
the file path or an empty path if it is not available

The documentation for this class was generated from the following file:

Generated on Mon Oct 8 2018 08:38:45 for Util-- by doxygen 1.8.11
SourceForge.net Project Page