utilmm::tempfile Class Reference
[OS-related tools]

#include <utilmm/system/system.hh>

List of all members.

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

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

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

FILE* utilmm::tempfile::handle (  )  const

Get the underlying file handle

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

Creates a temporary file

Returns:
the file descriptor to the open file
Exceptions:
unix_error an error occured


The documentation for this class was generated from the following file:
Generated on Tue Feb 19 10:51:01 2008 for Util-- by doxygen 1.5.3
SourceForge.net Project Page