1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>C Standard Library Extensions: File Utilities</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">C Standard Library Extensions
 <span id="projectnumber">1.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">File Utilities</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gad1b34a4ae9f02012bf25f4431a783d1f"><td class="memItemLeft" align="right" valign="top">cxlong </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxfileutils.html#gad1b34a4ae9f02012bf25f4431a783d1f">cx_path_max</a> (const cxchar *path)</td></tr>
<tr class="memdesc:gad1b34a4ae9f02012bf25f4431a783d1f"><td class="mdescLeft"> </td><td class="mdescRight">Get the maximum length of a path relative to the given directory. <a href="#gad1b34a4ae9f02012bf25f4431a783d1f"></a><br/></td></tr>
<tr class="memitem:ga48dab751d6469555e885ecc7be2b667b"><td class="memItemLeft" align="right" valign="top">cxchar * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cxfileutils.html#ga48dab751d6469555e885ecc7be2b667b">cx_path_alloc</a> (const char *path)</td></tr>
<tr class="memdesc:ga48dab751d6469555e885ecc7be2b667b"><td class="mdescLeft"> </td><td class="mdescRight">Allocate a buffer suitable for storing a relative pathname staring at a given directory. <a href="#ga48dab751d6469555e885ecc7be2b667b"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>The module provides a collection of useful file and file path related utility functions.</p>
<dl class="section user"><dt>Synopsis:</b></dt><dd><div class="fragment"><pre class="fragment"><span class="preprocessor"> #include <cxfileutils.h></span>
</pre></div> </dd></dl>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga48dab751d6469555e885ecc7be2b667b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cxchar* <a class="el" href="group__cxfileutils.html#ga48dab751d6469555e885ecc7be2b667b">cx_path_alloc</a> </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>path</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Allocate a buffer suitable for storing a relative pathname staring at a given directory. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">path</td><td>Directory name the relative path should start from.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>Allocated buffer of appropriate size, or <code>NULL</code> in case of an error.</dd></dl>
<p>The function determines the maximum possible length of a relative path name when <em>path</em> is the current working directory. A buffer with the appropriate length for the relative pathname including the trailing zero. The argument <em>path</em> must be the name of an existing, or the function fails. The allocated buffer can be destroyed by calling <b><a class="el" href="group__cxmemory.html#ga535a509573c6617da8f0dccdb2710bc9" title="Memory block deallocation.">cx_free()</a></b>.</p>
<p>IF the string "/" is used for <em>path</em> the returned buffer will have the maximum length possible for an absolute path supported by the system (but see the note for <b><a class="el" href="group__cxfileutils.html#gad1b34a4ae9f02012bf25f4431a783d1f" title="Get the maximum length of a path relative to the given directory.">cx_path_max()</a></b> for pitfalls). </p>
<p>References <a class="el" href="group__cxmemory.html#gad6e24975b7161a4d3f5fe49fd84df740">cx_calloc()</a>, and <a class="el" href="group__cxfileutils.html#gad1b34a4ae9f02012bf25f4431a783d1f">cx_path_max()</a>.</p>
</div>
</div>
<a class="anchor" id="gad1b34a4ae9f02012bf25f4431a783d1f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cxlong <a class="el" href="group__cxfileutils.html#gad1b34a4ae9f02012bf25f4431a783d1f">cx_path_max</a> </td>
<td>(</td>
<td class="paramtype">const cxchar * </td>
<td class="paramname"><em>path</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the maximum length of a path relative to the given directory. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">path</td><td>Directory name.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>Maximum path length.</dd></dl>
<p>The function returns the maximum length a relative path when <em>path</em> is the current working directory. To get the maximum possible length of an absolute path pass "/" for <em>path</em>, but see the note below. The size is determined through the <b>pathconf()</b> function, or if this is not available the maximum length is simply set to the ad hoc length of 4095 characters.</p>
<dl class="section note"><dt>Note:</dt><dd>The maximum length of a pathname depends on the underlying filesystem. This means that the method to determine the maximum possible length of an absolute pathname might be incorrect if the root directory and the actual location of the file under consideration are located on different filesystems. </dd></dl>
<p>Referenced by <a class="el" href="group__cxfileutils.html#ga48dab751d6469555e885ecc7be2b667b">cx_path_alloc()</a>.</p>
</div>
</div>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue May 22 2012 06:56:06 for C Standard Library Extensions by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
|