Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > e8cbfa9673da18966abee0a6d7051b87 > files > 539

glibmm2.4-doc-2.16.1-1mdv2008.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>glibmm 2.4: File Utilities</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<table border="0" width="100%">
<tr>
    <td width="10%" height="40"><img src="../../images/gtkmm_logo.gif" alt="logo" border="0" width="100%" height="100%"/></td>
    <td width="90%" height="40"><img src="../../images/top.gif" alt="top" width="100%" height="40"/></td>
</tr>
</table>
<center>
  <a class="qindex" href="../../../../gtkmm-2.4/docs/index.html">Main Page</a> &nbsp;
  <a href="../../../../gtkmm-2.4/docs/reference/html/group__Widgets.html">Widgets</a> &nbsp;
  <a class="qindex" href="namespaces.html">glibmm Namespaces</a> &nbsp;
  <a href="../../../../gtkmm-2.4/docs/tutorial/html/index.html"> Book</a> &nbsp;
</center>
<hr width="100%"/>

<!-- begin main content -->
<div id="content">
<!-- Generated by Doxygen 1.5.3 -->
<h1>File Utilities</h1>Various file-related classes and functions.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1FileError.html">Glib::FileError</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="classGlib_1_1Exception.html">Exception</a> class for file-related errors.  <a href="classGlib_1_1FileError.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1DirIterator.html">Glib::DirIterator</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The iterator type of <a class="el" href="classGlib_1_1Dir.html" title="Utility class representing an open directory.">Glib::Dir</a>.  <a href="classGlib_1_1DirIterator.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dir.html">Glib::Dir</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Utility class representing an open directory.  <a href="classGlib_1_1Dir.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#g0b2fce78896a9a84f7ea3a5646cc7d36">Glib::file_test</a> (const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>&amp; filename, FileTest test)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns <code>true</code> if any of the tests in the bitfield <em>test</em> are true.  <a href="#g0b2fce78896a9a84f7ea3a5646cc7d36"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#ge4c8d716bd109b6b8e1420a8c20b3507">Glib::mkstemp</a> (<a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>&amp; filename_template)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Opens a temporary file.  <a href="#ge4c8d716bd109b6b8e1420a8c20b3507"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#ge91f239f1cf0123399374deed54fbf3a">Glib::file_open_tmp</a> (<a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>&amp; name_used, const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>&amp; prefix)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gc42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files.">Glib::get_tmp_dir()</a>).  <a href="#ge91f239f1cf0123399374deed54fbf3a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#g682379de4ea119540b4bdc1759e93e1d">Glib::file_open_tmp</a> (<a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>&amp; name_used)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gc42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files.">Glib::get_tmp_dir()</a>).  <a href="#g682379de4ea119540b4bdc1759e93e1d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__FileUtils.html#g835da54212fe78e833ac55b49150b989">Glib::file_get_contents</a> (const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a>&amp; filename)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Reads an entire file into a string, with good error checking.  <a href="#g835da54212fe78e833ac55b49150b989"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Various file-related classes and functions. 
<p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g835da54212fe78e833ac55b49150b989"></a><!-- doxytag: member="Glib::file_get_contents" ref="g835da54212fe78e833ac55b49150b989" args="(const std::string &amp;filename)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> Glib::file_get_contents           </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>filename</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Reads an entire file into a string, with good error checking. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>A file to read contents from. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The file contents. </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors.">Glib::FileError</a></em>&nbsp;</td><td></td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="g682379de4ea119540b4bdc1759e93e1d"></a><!-- doxytag: member="Glib::file_open_tmp" ref="g682379de4ea119540b4bdc1759e93e1d" args="(std::string &amp;name_used)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Glib::file_open_tmp           </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>name_used</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gc42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files.">Glib::get_tmp_dir()</a>). 
<p>
This function works like <a class="el" href="group__FileUtils.html#ge91f239f1cf0123399374deed54fbf3a" title="Opens a file for writing in the preferred directory for temporary files (as returned...">file_open_tmp(std::string&amp;, const std::string&amp;)</a> but uses a default basename prefix.<p>
<dl compact><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name_used</em>&nbsp;</td><td>The actual name used. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A file handle (as from <code>open()</code>) 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 <code>close()</code>. </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors.">Glib::FileError</a></em>&nbsp;</td><td></td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="ge91f239f1cf0123399374deed54fbf3a"></a><!-- doxytag: member="Glib::file_open_tmp" ref="ge91f239f1cf0123399374deed54fbf3a" args="(std::string &amp;name_used, const std::string &amp;prefix)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Glib::file_open_tmp           </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>name_used</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>prefix</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Opens a file for writing in the preferred directory for temporary files (as returned by <a class="el" href="group__MiscUtils.html#gc42272146fd9320958132f1591d28991" title="Gets the directory to use for temporary files.">Glib::get_tmp_dir()</a>). 
<p>
<em>prefix</em> should a basename template; it'll be suffixed by 6 characters in order to form a unique filename. No directory components are allowed.<p>
The actual name used is returned in <em>name_used</em>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>prefix</em>&nbsp;</td><td>Template for file name, basename only. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name_used</em>&nbsp;</td><td>The actual name used. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A file handle (as from <code>open()</code>) 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 <code>close()</code>. </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors.">Glib::FileError</a></em>&nbsp;</td><td></td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="g0b2fce78896a9a84f7ea3a5646cc7d36"></a><!-- doxytag: member="Glib::file_test" ref="g0b2fce78896a9a84f7ea3a5646cc7d36" args="(const std::string &amp;filename, FileTest test)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Glib::file_test           </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FileTest&nbsp;</td>
          <td class="paramname"> <em>test</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns <code>true</code> if any of the tests in the bitfield <em>test</em> are true. 
<p>
For example, <code>(<a class="el" href="group__glibmmEnums.html#gg33c24ccefbd130021f06708763e16ef237c8f223bda6b6ce2875490351989ddd">Glib::FILE_TEST_EXISTS</a> | <a class="el" href="group__glibmmEnums.html#gg33c24ccefbd130021f06708763e16ef2d3679641c18e5e4d4578c2122492cea4">Glib::FILE_TEST_IS_DIR</a>)</code> will return <code>true</code> if the file exists; the check whether it's a directory doesn't matter since the existence test is true. With the current set of available tests, there's no point passing in more than one test at a time.<p>
Apart from <code><a class="el" href="group__glibmmEnums.html#gg33c24ccefbd130021f06708763e16ef286cda9ff0bf25358070a9bc8b4a186d6">Glib::FILE_TEST_IS_SYMLINK</a></code> all tests follow symbolic links, so for a symbolic link to a regular file <a class="el" href="group__FileUtils.html#g0b2fce78896a9a84f7ea3a5646cc7d36" title="Returns true if any of the tests in the bitfield test are true.">file_test()</a> will return <code>true</code> for both <code><a class="el" href="group__glibmmEnums.html#gg33c24ccefbd130021f06708763e16ef286cda9ff0bf25358070a9bc8b4a186d6">Glib::FILE_TEST_IS_SYMLINK</a></code> and <code><a class="el" href="group__glibmmEnums.html#gg33c24ccefbd130021f06708763e16ef23181e2e655e765b00dfdb1e1ea443f62">Glib::FILE_TEST_IS_REGULAR</a></code>.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>For a dangling symbolic link <a class="el" href="group__FileUtils.html#g0b2fce78896a9a84f7ea3a5646cc7d36" title="Returns true if any of the tests in the bitfield test are true.">file_test()</a> will return <code>true</code> for <code><a class="el" href="group__glibmmEnums.html#gg33c24ccefbd130021f06708763e16ef286cda9ff0bf25358070a9bc8b4a186d6">Glib::FILE_TEST_IS_SYMLINK</a></code> and <code>false</code> for all other flags.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>A filename to test. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>test</em>&nbsp;</td><td>Bitfield of <a class="el" href="group__glibmmEnums.html#g33c24ccefbd130021f06708763e16ef2" title="Bitwise operators:FileTest operator|(FileTest, FileTest)  FileTest operator&amp;(FileTest...">Glib::FileTest</a> flags. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Whether a test was true. </dd></dl>

</div>
</div><p>
<a class="anchor" name="ge4c8d716bd109b6b8e1420a8c20b3507"></a><!-- doxytag: member="Glib::mkstemp" ref="ge4c8d716bd109b6b8e1420a8c20b3507" args="(std::string &amp;filename_template)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Glib::mkstemp           </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1basic__string.html">std::string</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>filename_template</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Opens a temporary file. 
<p>
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. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>filename_template</em>&nbsp;</td><td>A string that should match the rules for mkstemp(), i.e. end in <code>"XXXXXX"</code>. The <code>X</code> string will be modified to form the name of a file that didn't exist. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>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, <code>-1</code> is returned. </dd></dl>

</div>
</div><p>
</div> <!-- end main content -->

<hr><address><small>
Generated for glibmm 2.4 by <a href="http://www.doxygen.org/index.html">
Doxygen</a> 1.5.3 &copy;&nbsp;1997-2001</small></address>
</body>
</html>