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

📄 glib-miscellaneous-utility-functions.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<tbody><tr><td><p><span class="term"><em class="parameter"><code>variable</code></em>&#160;:</span></p></td><td> the environment variable to get, in the GLib file name encoding.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> the value of the environment variable, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> ifthe environment variable is not found. The returned string may beoverwritten by the next call to <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-getenv"><code class="function">g_getenv()</code></a>, <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-setenv"><code class="function">g_setenv()</code></a> or<a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-unsetenv"><code class="function">g_unsetenv()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3069948"></a><h3><a name="g-setenv"></a>g_setenv ()</h3><a class="indexterm" name="id3069962"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            g_setenv                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *variable,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *value,                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> overwrite);</pre><p>Sets an environment variable. Both the variable's name and valueshould be in the GLib file name encoding. On UNIX, this means thatthey can be any sequence of bytes. On Windows, they should be inUTF-8.</p><p>Note that on some systems, when variables are overwritten, the memory used for the previous variables and its value isn't reclaimed.</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>variable</code></em>&#160;:</span></p></td><td> the environment variable to set, must not contain '='.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></p></td><td> the value for to set the variable to.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>overwrite</code></em>&#160;:</span></p></td><td> whether to change the variable if it already exists.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the environment variable couldn't be set.</td></tr></tbody></table></div><p class="since">Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3070094"></a><h3><a name="g-unsetenv"></a>g_unsetenv ()</h3><a class="indexterm" name="id3070109"></a><pre class="programlisting">void                g_unsetenv                          (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *variable);</pre><p>Removes an environment variable from the environment.</p><p>Note that on some systems, when variables are overwritten, the memory used for the previous variables and its value isn't reclaimed.Furthermore, this function can't be guaranteed to operate in a threadsafe way.</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>variable</code></em>&#160;:</span></p></td><td> the environment variable to remove, must not contain '='.</td></tr></tbody></table></div><p class="since">Since  2.4 </p></div><hr><div class="refsect2" lang="en"><a name="id3070174"></a><h3><a name="g-listenv"></a>g_listenv ()</h3><a class="indexterm" name="id3070188"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>**             g_listenv                           (void);</pre><p>Gets the names of all variables set in the environment.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of strings which must be freedwith <a class="link" href="glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a>.Programs that want to be portable to Windows should typically usethis function and <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-getenv"><code class="function">g_getenv()</code></a> instead of using the environ arrayfrom the C library directly. On Windows, the strings in the environarray are in system codepage encoding, while in most of the typicaluse cases for environment variables in GLib-using programs you wantthe UTF-8 encoding that this function and <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-getenv"><code class="function">g_getenv()</code></a> provide.</td></tr></tbody></table></div><p class="since">Since  2.8</p></div><hr><div class="refsect2" lang="en"><a name="id3070283"></a><h3><a name="g-get-user-name"></a>g_get_user_name ()</h3><a class="indexterm" name="id3070296"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_get_user_name                     (void);</pre><p>Gets the user name of the current user. The encoding of the returnedstring is system-defined. On UNIX, it might be the preferred file nameencoding, or something else, and there is no guarantee that it is evenconsistent on a machine. On Windows, it is always UTF-8.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> the user name of the current user.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3070342"></a><h3><a name="g-get-real-name"></a>g_get_real_name ()</h3><a class="indexterm" name="id3070354"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_get_real_name                     (void);</pre><p>Gets the real name of the user. This usually comes from the user's entry in the <code class="filename">passwd</code> file. The encoding of the returned string is system-defined. (On Windows, it is, however, always UTF-8.) If the real user name cannot be determined, the string "Unknown" is returned.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> the user's real name.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3070405"></a><h3><a name="g-get-user-cache-dir"></a>g_get_user_cache_dir ()</h3><a class="indexterm" name="id3070421"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_get_user_cache_dir                (void);</pre><p>Returns a base directory in which to store non-essential, cacheddata specific to particular user.</p><p>On UNIX platforms this is determined using the mechanisms described inthe <a class="ulink" href="http://www.freedesktop.org/Standards/basedir-spec" target="_top">XDG Base Directory Specification</a></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a string owned by GLib that must not be modified               or freed.</td></tr></tbody></table></div><p class="since">Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3070482"></a><h3><a name="g-get-user-data-dir"></a>g_get_user_data_dir ()</h3><a class="indexterm" name="id3070498"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_get_user_data_dir                 (void);</pre><p>Returns a base directory in which to access application data suchas icons that is customized for a particular user.  </p><p>On UNIX platforms this is determined using the mechanisms described inthe <a class="ulink" href="http://www.freedesktop.org/Standards/basedir-spec" target="_top">XDG Base Directory Specification</a></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a string owned by GLib that must not be modified               or freed.</td></tr></tbody></table></div><p class="since">Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3070558"></a><h3><a name="g-get-user-config-dir"></a>g_get_user_config_dir ()</h3><a class="indexterm" name="id3070573"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_get_user_config_dir               (void);</pre><p>Returns a base directory in which to store user-specific application configuration information such as user preferences and settings. </p><p>On UNIX platforms this is determined using the mechanisms described inthe <a class="ulink" href="http://www.freedesktop.org/Standards/basedir-spec" target="_top">XDG Base Directory Specification</a></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a string owned by GLib that must not be modified               or freed.</td></tr></tbody></table></div><p class="since">Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3070634"></a><h3><a name="GUserDirectory"></a>enum GUserDirectory</h3><a class="indexterm" name="id3070649"></a><pre class="programlisting">typedef enum {  G_USER_DIRECTORY_DESKTOP,  G_USER_DIRECTORY_DOCUMENTS,  G_USER_DIRECTORY_DOWNLOAD,  G_USER_DIRECTORY_MUSIC,  G_USER_DIRECTORY_PICTURES,  G_USER_DIRECTORY_PUBLIC_SHARE,  G_USER_DIRECTORY_TEMPLATES,  G_USER_DIRECTORY_VIDEOS,  G_USER_N_DIRECTORIES

⌨️ 快捷键说明

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