Various file-related classes and functions.  
More...
Various file-related classes and functions. 
Reads an entire file into a string, with good error checking. 
- Parameters
- 
  
    | filename | A file to read contents from. |  
 
- Returns
- The file contents. 
- Exceptions
- 
  
  
 
 
Opens a file for writing in the preferred directory for temporary files (as returned by Glib::get_tmp_dir()). 
prefix should a basename template; it'll be suffixed by 6 characters in order to form a unique filename. No directory components are allowed.
The actual name used is returned in name_used.
- Parameters
- 
  
    | [out] | name_used | The actual name used. |  |  | prefix | Template for file name, basename only. |  
 
- Returns
- A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed withclose().
- Exceptions
- 
  
  
 
 
Opens a file for writing in the preferred directory for temporary files (as returned by Glib::get_tmp_dir()). 
This function works like file_open_tmp(std::string&, const std::string&) but uses a default basename prefix.
- Parameters
- 
  
    | [out] | name_used | The actual name used. |  
 
- Returns
- A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed withclose().
- Exceptions
- 
  
  
 
 
Opens a temporary file. 
See the mkstemp() documentation on most UNIX-like systems. This is a portability wrapper, which simply calls mkstemp() on systems that have it, and implements it in GLib otherwise. 
- Parameters
- 
  
    | filename_template | A string that should match the rules for mkstemp(), i.e. end in "XXXXXX". TheXstring will be modified to form the name of a file that didn't exist. |  
 
- Returns
- A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with close(). In case of errors, -1is returned.