⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-miscellaneous-utility-functions.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<h3 class="title">Warning</h3><p><code class="literal">g_dirname</code> is deprecated and should not be used in newly-written code.</p></div><p>This function is deprecated and will be removed in the next majorrelease of GLib. Use <a href="glib-Miscellaneous-Utility-Functions.html#g-path-get-dirname"><code class="function">g_path_get_dirname()</code></a> instead.</p><p>Gets the directory components of a file name.If the file name has no directory components "." is returned.The returned string should be freed when no longer needed.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the directory components of the file.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3022282"></a><h3><a name="g-path-is-absolute"></a>g_path_is_absolute ()</h3><a class="indexterm" name="id3022293"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_path_is_absolute              (const <a href="glib-Basic-Types.html#gchar">gchar</a> *file_name);</pre><p>Returns <code class="literal">TRUE</code> if the given <em class="parameter"><code>file_name</code></em> is an absolute file name,i.e. it contains a full path from the root directory such as '/usr/local'on UNIX or 'C:\windows' on Windows systems.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>file_name</code></em>&#160;:</span></td><td>a file name.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td><code class="literal">TRUE</code> if <em class="parameter"><code>file_name</code></em> is an absolute path.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3022375"></a><h3><a name="g-path-skip-root"></a>g_path_skip_root ()</h3><a class="indexterm" name="id3022385"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_path_skip_root               (const <a href="glib-Basic-Types.html#gchar">gchar</a> *file_name);</pre><p>Returns a pointer into <em class="parameter"><code>file_name</code></em> after the root component, i.e. afterthe '/' in UNIX or 'C:\' under Windows. If <em class="parameter"><code>file_name</code></em> is not an absolutepath it returns <code class="literal">NULL</code>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>file_name</code></em>&#160;:</span></td><td>a file name.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>a pointer into <em class="parameter"><code>file_name</code></em> after the root component.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3022470"></a><h3><a name="g-path-get-basename"></a>g_path_get_basename ()</h3><a class="indexterm" name="id3022481"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_path_get_basename             (const <a href="glib-Basic-Types.html#gchar">gchar</a> *file_name);</pre><p>Gets the last component of the filename. If <em class="parameter"><code>file_name</code></em> ends with a directory separator it gets the component before the last slash. If <em class="parameter"><code>file_name</code></em> consists only of directory separators (and on Windows, possibly a drive letter), a single separator is returned. If<em class="parameter"><code>file_name</code></em> is empty, it gets ".".</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>file_name</code></em>&#160;:</span></td><td> the name of the file.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> a newly allocated string containing the last component of   the filename.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3022564"></a><h3><a name="g-path-get-dirname"></a>g_path_get_dirname ()</h3><a class="indexterm" name="id3022576"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_path_get_dirname              (const <a href="glib-Basic-Types.html#gchar">gchar</a> *file_name);</pre><p>Gets the directory components of a file name.  If the file name has nodirectory components "." is returned.  The returned string should befreed when no longer needed.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>file_name</code></em>&#160;:</span></td><td>the name of the file.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the directory components of the file.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3022636"></a><h3><a name="g-build-filename"></a>g_build_filename ()</h3><a class="indexterm" name="id3022646"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_build_filename                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *first_element,                                             ...);</pre><p>Creates a filename from a series of elements using the correctseparator for filenames.</p><p>On Unix, this function behaves identically to <code class="literal">g_build_path(G_DIR_SEPARATOR_S, first_element, ....)</code>.</p><p>On Windows, it takes into account that either the backslash(<code class="literal">\</code> or slash (<code class="literal">/</code>) can be usedas separator in filenames, but otherwise behaves as on Unix. Whenfile pathname separators need to be inserted, the one that lastpreviously occurred in the parameters (reading from left to right)is used.</p><p>No attempt is made to force the resulting filename to be an absolutepath. If the first element is a relative path, the result willbe a relative path.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>first_element</code></em>&#160;:</span></td><td> the first element in the path</td></tr><tr><td><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></td><td> remaining elements in path, terminated by <code class="literal">NULL</code></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> a newly-allocated string that must be freed with <a href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3022776"></a><h3><a name="g-build-path"></a>g_build_path ()</h3><a class="indexterm" name="id3022786"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_build_path                    (const <a href="glib-Basic-Types.html#gchar">gchar</a> *separator,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *first_element,                                             ...);</pre><p>Creates a path from a series of elements using <em class="parameter"><code>separator</code></em> as theseparator between elements. At the boundary between two elements,any trailing occurrences of separator in the first element, orleading occurrences of separator in the second element are removedand exactly one copy of the separator is inserted.</p><p>Empty elements are ignored.</p><p>The number of leading copies of the separator on the result isthe same as the number of leading copies of the separator onthe first non-empty element.</p><p>The number of trailing copies of the separator on the result isthe same as the number of trailing copies of the separator onthe last non-empty element. (Determination of the number oftrailing copies is done without stripping leading copies, soif the separator is <code class="literal">ABA</code>, <code class="literal">ABABA</code>has 1 trailing copy.)</p><p>However, if there is only a single non-empty element, and thereare no characters in that element not part of the leading ortrailing separators, then the result is exactly the original valueof that element.</p><p>Other than for determination of the number of leading and trailingcopies of the separator, elements consisting only of copiesof the separator are ignored.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>separator</code></em>&#160;:</span></td><td> a string used to separator the elements of the path.</td></tr><tr><td><span class="term"><em class="parameter"><code>first_element</code></em>&#160;:</span></td><td> the first element in the path</td></tr><tr><td><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></td><td> remaining elements in path, terminated by <code class="literal">NULL</code></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> a newly-allocated string that must be freed with <a href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3022954"></a><h3><a name="g-find-program-in-path"></a>g_find_program_in_path ()</h3><a class="indexterm" name="id3022965"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_find_program_in_path          (const <a href="glib-Basic-Types.html#gchar">gchar</a> *program);</pre><p>Locates the first executable named <em class="parameter"><code>program</code></em> in the user's path, in thesame way that <code class="function">execvp()</code> would locate it. Returns an allocated stringwith the absolute path name, or <code class="literal">NULL</code> if the program is not found inthe path. If <em class="parameter"><code>program</code></em> is already an absolute path, returns a copy of<em class="parameter"><code>program</code></em> if <em class="parameter"><code>program</code></em> exists and is executable, and <code class="literal">NULL</code> otherwise. On Windows, if <em class="parameter"><code>program</code></em> does not have a file type suffix, trieswith the suffixes .exe, .cmd, .bat and .com, and the suffixes inthe <code class="envar">PATHEXT</code> environment variable.</p><p>It looks for the file in the same way as <code class="function">CreateProcess()</code>would. This means first in the directory where the executingprogram was loaded from, then in the current directory, then in theWindows 32-bit system directory, then in the Windows directory, andfinally in the directories in the <code class="envar">PATH</code> environment variable. If the program is found, the return value contains the full name including the type suffix.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>program</code></em>&#160;:</span></td><td> a program name in the GLib file name encoding</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> absolute path, or <code class="literal">NULL</code></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3023121"></a><h3><a name="g-bit-nth-lsf"></a>g_bit_nth_lsf ()</h3><a class="indexterm" name="id3023131"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_bit_nth_lsf                   (<a href="glib-Basic-Types.html#gulong">gulong</a> mask,                                             <a href="glib-Basic-Types.html#gint">gint</a> nth_bit);</pre>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -