My Project
Static Public Member Functions | List of all members
FileUtil Class Reference

#include <FileUtil.h>

Static Public Member Functions

static std::string createTempFilename (const std::string &prefix, const std::string &suffix="")
 Creates a temporary file name with the format "prefix".XXXXXXsuffix. This format is used with mkstemp to create a temporary file. More...
 
static void deleteTempFilename (const std::string &filename)
 Deletes a temporary file name. More...
 
static bool write (const std::string &s, const std::string &filename, std::string &error)
 Writes a string into a file. More...
 

Detailed Description

Author
Jordi Cortadella
Date
05/01/19

Member Function Documentation

◆ createTempFilename()

static std::string FileUtil::createTempFilename ( const std::string &  prefix,
const std::string &  suffix = "" 
)
inlinestatic

Creates a temporary file name with the format "prefix".XXXXXXsuffix. This format is used with mkstemp to create a temporary file.

Parameters
prefixPrefix of the file.
suffixSuffix of the file.
Returns
The file name.

◆ deleteTempFilename()

static void FileUtil::deleteTempFilename ( const std::string &  filename)
inlinestatic

Deletes a temporary file name.

Parameters
filenameThe name of the file.

◆ write()

static bool FileUtil::write ( const std::string &  s,
const std::string &  filename,
std::string &  error 
)
inlinestatic

Writes a string into a file.

Parameters
sThe string to be written.
filenameThe name of the file (if empty, the string is written into cout).
errorIn case of error, the message is stored in this parameter.
Returns
True if successful, and false otherwise.
Note
error is only modified in case an error is produced.

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