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

📄 glib-windows-compatability-functions.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Windows Compatibility Functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.0"><link rel="start" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-utilities.html" title="GLib Utilities"><link rel="prev" href="glib-Key-value-file-parser.html" title="Key-value file parser"><link rel="next" href="glib-data-types.html" title="GLib Data Types"><meta name="generator" content="GTK-Doc V1.4 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Key-value-file-parser.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GLib Reference Manual</th><td><a accesskey="n" href="glib-data-types.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="glib-Windows-Compatability-Functions"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">Windows Compatibility Functions</span></h2><p>Windows Compatibility Functions &#8212; UNIX emulation on Windows.</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include &lt;glib.h&gt;#define     <a href="glib-Windows-Compatability-Functions.html#MAXPATHLEN:CAPS">MAXPATHLEN</a>#define     <a href="glib-Windows-Compatability-Functions.html#pipe">pipe</a>                            (phandles)<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-Windows-Compatability-Functions.html#g-win32-error-message">g_win32_error_message</a>           (<a href="glib-Basic-Types.html#gint">gint</a> error);<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-Windows-Compatability-Functions.html#g-win32-getlocale">g_win32_getlocale</a>               (void);<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-Windows-Compatability-Functions.html#g-win32-get-package-installation-directory">g_win32_get_package_installation_directory</a>                                            (<a href="glib-Basic-Types.html#gchar">gchar</a> *package,                                             <a href="glib-Basic-Types.html#gchar">gchar</a> *dll_name);<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-Windows-Compatability-Functions.html#g-win32-get-package-installation-subdirectory">g_win32_get_package_installation_subdirectory</a>                                            (<a href="glib-Basic-Types.html#gchar">gchar</a> *package,                                             <a href="glib-Basic-Types.html#gchar">gchar</a> *dll_name,                                             <a href="glib-Basic-Types.html#gchar">gchar</a> *subdir);<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-Windows-Compatability-Functions.html#g-win32-get-windows-version">g_win32_get_windows_version</a>     (void);#define     <a href="glib-Windows-Compatability-Functions.html#G-WIN32-DLLMAIN-FOR-DLL-NAME:CAPS">G_WIN32_DLLMAIN_FOR_DLL_NAME</a>    (static, dll_name)#define     <a href="glib-Windows-Compatability-Functions.html#G-WIN32-HAVE-WIDECHAR-API:CAPS">G_WIN32_HAVE_WIDECHAR_API</a>       ()#define     <a href="glib-Windows-Compatability-Functions.html#G-WIN32-IS-NT-BASED:CAPS">G_WIN32_IS_NT_BASED</a>             ()</pre></div><div class="refsect1" lang="en"><a name="id3098238"></a><h2>Description</h2><p></p></div><div class="refsect1" lang="en"><a name="id3098248"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3098254"></a><h3><a name="MAXPATHLEN:CAPS"></a>MAXPATHLEN</h3><a class="indexterm" name="id3098264"></a><pre class="programlisting">#define MAXPATHLEN 1024</pre><p>Provided for UNIX emulation on Windows; equivalent to UNIX macro <code class="literal">MAXPATHLEN</code>, which is the maximum length of a filename(including full path).</p></div><hr><div class="refsect2" lang="en"><a name="id3098287"></a><h3><a name="pipe"></a>pipe()</h3><a class="indexterm" name="id3098297"></a><pre class="programlisting">#define pipe(phandles)	_pipe (phandles, 4096, _O_BINARY)</pre><p>Provided for UNIX emulation on Windows; see documentation for <code class="function"><a href="glib-Windows-Compatability-Functions.html#pipe"><code class="function">pipe()</code></a></code>in any UNIX manual.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>phandles</code></em>&#160;:</span></td><td></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3098346"></a><h3><a name="g-win32-error-message"></a>g_win32_error_message ()</h3><a class="indexterm" name="id3098357"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_win32_error_message           (<a href="glib-Basic-Types.html#gint">gint</a> error);</pre><p>Translate a Win32 error code (as returned by <code class="function">GetLastError()</code>) intothe corresponding message. The message is either language neutral,or in the thread's language, or the user's language, the system'slanguage, or US English (see docs for <code class="function">FormatMessage()</code>). Thereturned string is in UTF-8. It should be deallocated with<a href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td><td> error code.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> newly-allocated error message</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3098454"></a><h3><a name="g-win32-getlocale"></a>g_win32_getlocale ()</h3><a class="indexterm" name="id3098466"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_win32_getlocale               (void);</pre><p>The <code class="function">setlocale()</code> function in the Microsoft C library uses localenames of the form "English_United States.1252" etc. We want theUNIXish standard form "en_US", "zh_TW" etc. This function gets thecurrent thread locale from Windows - without any encoding info -and returns it as a string of the above form for use in formingfile names etc. The returned string should be deallocated with<a href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p><p></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> newly-allocated locale name.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3098532"></a><h3><a name="g-win32-get-package-installation-directory"></a>g_win32_get_package_installation_directory ()</h3><a class="indexterm" name="id3098545"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_win32_get_package_installation_directory                                            (<a href="glib-Basic-Types.html#gchar">gchar</a> *package,                                             <a href="glib-Basic-Types.html#gchar">gchar</a> *dll_name);</pre><p>Try to determine the installation directory for a software package.Typically used by GNU software packages.</p><p><em class="parameter"><code>package</code></em> should be a short identifier for the package. Typically itis the same identifier as used for<code class="literal">GETTEXT_PACKAGE</code> in software configured accordingto GNU standards. The function first looks in the Windows Registryfor the value <code class="literal">#InstallationDirectory</code> in the key<code class="literal">#HKLM\Software\<em class="parameter"><code>package</code></em></code>, and if that valueexists and is a string, returns that.</p><p>If <em class="parameter"><code>package</code></em> is <code class="literal">NULL</code>, or the above value isn't found in theRegistry, but <em class="parameter"><code>dll_name</code></em> is non-<code class="literal">NULL</code>, it should name a DLL loadedinto the current process. Typically that would be the name of theDLL calling this function, looking for its installationdirectory. The function then asks Windows what directory that DLLwas loaded from. If that directory's last component is "bin" or"lib", the parent directory is returned, otherwise the directoryitself. If that DLL isn't loaded, the function proceeds as if<em class="parameter"><code>dll_name</code></em> was <code class="literal">NULL</code>.</p><p>If both <em class="parameter"><code>package</code></em> and <em class="parameter"><code>dll_name</code></em> are <code class="literal">NULL</code>, the directory from wherethe main executable of the process was loaded is uses instead inthe same way as above.</p>

⌨️ 快捷键说明

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