?? glib-miscellaneous-utility-functions.html
字號(hào):
</tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a newly-allocated string that must be freed with <a class="link" 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="id3072436"></a><h3><a name="g-build-filenamev"></a>g_build_filenamev ()</h3><a class="indexterm" name="id3072451"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_build_filenamev (<a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **args);</pre><p>Behaves exactly like <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-build-filename"><code class="function">g_build_filename()</code></a>, but takes the path elements as a string array, instead of varargs. This function is mainlymeant for language bindings.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td><td> <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings containing the path elements.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a newly-allocated string that must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</td></tr></tbody></table></div><p class="since">Since 2.8</p></div><hr><div class="refsect2" lang="en"><a name="id3072552"></a><h3><a name="g-build-path"></a>g_build_path ()</h3><a class="indexterm" name="id3072565"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_build_path (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *separator, const <a class="link" 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><p><span class="term"><em class="parameter"><code>separator</code></em> :</span></p></td><td> a string used to separator the elements of the path.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>first_element</code></em> :</span></p></td><td> the first element in the path</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td> remaining elements in path, terminated by <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a newly-allocated string that must be freed with <a class="link" 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="id3072737"></a><h3><a name="g-build-pathv"></a>g_build_pathv ()</h3><a class="indexterm" name="id3072753"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_build_pathv (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *separator, <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **args);</pre><p>Behaves exactly like <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-build-path"><code class="function">g_build_path()</code></a>, but takes the path elements as a string array, instead of varargs. This function is mainlymeant for language bindings.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>separator</code></em> :</span></p></td><td> a string used to separator the elements of the path.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td><td> <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings containing the path elements.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a newly-allocated string that must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</td></tr></tbody></table></div><p class="since">Since 2.8</p></div><hr><div class="refsect2" lang="en"><a name="id3072876"></a><h3><a name="g-format-size-for-display"></a>g_format_size_for_display ()</h3><a class="indexterm" name="id3072892"></a><pre class="programlisting">char* g_format_size_for_display (<a class="link" href="glib-Basic-Types.html#goffset">goffset</a> size);</pre><p>Formats a size (for example the size of a file) into a human readable string.Sizes are rounded to the nearest size prefix (KB, MB, GB) and are displayed rounded tothe nearest tenth. E.g. the file size 3292528 bytes will be converted intothe string "3.1 MB".</p><p>The prefix units base is 1024 (i.e. 1 KB is 1024 bytes).</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td><td> a size in bytes.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a formatted string containing a human readable file size.</td></tr></tbody></table></div><p class="since">Since 2.16</p></div><hr><div class="refsect2" lang="en"><a name="id3072969"></a><h3><a name="g-find-program-in-path"></a>g_find_program_in_path ()</h3><a class="indexterm" name="id3072981"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_find_program_in_path (const <a class="link" 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 <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> 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 <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> 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>On Windows, 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><p><span class="term"><em class="parameter"><code>program</code></em> :</span></p></td><td> a program name in the GLib file name encoding</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> absolute path, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3073150"></a><h3><a name="g-bit-nth-lsf"></a>g_bit_nth_lsf ()</h3><a class="indexterm" name="id3073163"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_bit_nth_lsf (<a class="link" href="glib-Basic-Types.html#gulong">gulong</a> mask, <a class="link" href="glib-Basic-Types.html#gint">gint</a> nth_bit);</pre><p>Find the position of the first bit set in <em class="parameter"><code>mask</code></em>, searching from (but notincluding) <em class="parameter"><code>nth_bit</code></em> upwards. Bits are numbered from 0 (least significant)to sizeof(<a class="link" href="glib-Basic-Types.html#gulong"><span class="type">gulong</span></a>) * 8 - 1 (31 or 63, usually). To start searching from the0th bit, set <em class="parameter"><code>nth_bit</code></em> to -1.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td><td>a <a class="link" href="glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> containing flags.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>nth_bit</code></em> :</span></p></td><td>the index of the bit to start the search from.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the index of the first bit set which is higher than <em class="parameter"><code>nth_bit</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3073286"></a><h3><a name="g-bit-nth-msf"></a>g_bit_nth_msf ()</h3><a class="indexterm" name="id3073299"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -