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

📄 glib-file-utilities.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 4 页
字号:
</td></tr><tr><td><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td><td> permissions to use for the newly created directory</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> 0 if the directory was successfully created, -1 if an error    occurred</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3055214"></a><h3><a name="g-stat"></a>g_stat ()</h3><a class="indexterm" name="id3055224"></a><pre class="programlisting">int         g_stat                          (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,                                             struct stat *buf);</pre><p>A wrapper for the POSIX <code class="function">stat()</code> function. The <code class="function">stat()</code> function returns information about a file.</p><p>See the C library manual for more details about <code class="function">stat()</code>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td><td> a pathname in the GLib file name encoding</td></tr><tr><td><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></td><td> a pointer to a <span class="structname">stat</span> struct, which   will be filled with the file information</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> 0 if the information was successfully retrieved, -1 if an error    occurred</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3055351"></a><h3><a name="g-lstat"></a>g_lstat ()</h3><a class="indexterm" name="id3055362"></a><pre class="programlisting">int         g_lstat                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,                                             struct stat *buf);</pre><p>A wrapper for the POSIX <code class="function">lstat()</code> function. The <code class="function">lstat()</code> function islike <code class="function">stat()</code> except that in the case of symbolic links, it returnsinformation about the symbolic link itself and not the file that itrefers to. If the system does not support symbolic links <a href="glib-File-Utilities.html#g-lstat"><code class="function">g_lstat()</code></a>is identical to <a href="glib-File-Utilities.html#g-stat"><code class="function">g_stat()</code></a>.</p><p>See the C library manual for more details about <code class="function">lstat()</code>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td><td> a pathname in the GLib file name encoding</td></tr><tr><td><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></td><td> a pointer to a <span class="structname">stat</span> struct, which   will be filled with the file information</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> 0 if the information was successfully retrieved, -1 if an error    occurred</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3055523"></a><h3><a name="g-unlink"></a>g_unlink ()</h3><a class="indexterm" name="id3055534"></a><pre class="programlisting">int         g_unlink                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre><p>A wrapper for the POSIX <code class="function">unlink()</code> function. The <code class="function">unlink()</code> function deletes a name from the filesystem. If this was the last link to the file and no processes have it opened, the diskspace occupied by thefile is freed.</p><p>See your C library manual for more details about <code class="function">unlink()</code>. Notethat on Windows, it is in general not possible to delete files thatare open to some process, or mapped into memory.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td><td> a pathname in the GLib file name encoding</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> 0 if the name was successfully deleted, -1 if an error    occurred</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3055641"></a><h3><a name="g-remove"></a>g_remove ()</h3><a class="indexterm" name="id3055651"></a><pre class="programlisting">int         g_remove                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre><p>A wrapper for the POSIX <code class="function">remove()</code> function. The <code class="function">remove()</code> functiondeletes a name from the filesystem.</p><p>See your C library manual for more details about how <code class="function">remove()</code> workson your system. On Unix, <code class="function">remove()</code> removes also directories, as itcalls <code class="function">unlink()</code> for files and <code class="function">rmdir()</code> for directories. On Windows,although <code class="function">remove()</code> in the C library only works for files, thisfunction tries first <code class="function">remove()</code> and then if that fails <code class="function">rmdir()</code>, andthus works for both files and directories. Note however, that onWindows, it is in general not possible to remove a file that isopen to some process, or mapped into memory.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td><td> a pathname in the GLib file name encoding</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> 0 if the file was successfully removed, -1 if an error    occurred</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3055823"></a><h3><a name="g-rmdir"></a>g_rmdir ()</h3><a class="indexterm" name="id3055833"></a><pre class="programlisting">int         g_rmdir                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre><p>A wrapper for the POSIX <code class="function">rmdir()</code> function. The <code class="function">rmdir()</code> functiondeletes a directory from the filesystem.</p><p>See your C library manual for more details about how <code class="function">rmdir()</code> workson your system.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td><td> a pathname in the GLib file name encoding</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> 0 if the directory was successfully removed, -1 if an error    occurred</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3055935"></a><h3><a name="g-fopen"></a>g_fopen ()</h3><a class="indexterm" name="id3055945"></a><pre class="programlisting">FILE*       g_fopen                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *mode);</pre><p>A wrapper for the POSIX <code class="function">fopen()</code> function. The <code class="function">fopen()</code> function opensa file and associates a new stream with it. </p><p>See the C library manual for more details about <code class="function">fopen()</code>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td><td> a pathname in the GLib file name encoding</td></tr><tr><td><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td><td> a string describing the mode in which the file should be   opened</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> A <font color="red">&lt;typename&gt;FILE&lt;/typename&gt;</font> pointer if the file was successfully   opened, or <code class="literal">NULL</code> if an error occurred</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3056080"></a><h3><a name="g-freopen"></a>g_freopen ()</h3><a class="indexterm" name="id3056090"></a><pre class="programlisting">FILE*       g_freopen                       (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *mode,                                             FILE *stream);</pre><p>A wrapper for the POSIX <code class="function">freopen()</code> function. The <code class="function">freopen()</code> functionopens a file and associates it with an existing stream.</p><p>See the C library manual for more details about <code class="function">freopen()</code>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td><td> a pathname in the GLib file name encoding</td></tr><tr><td><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td><td> a string describing the mode in which the file should be   opened</td></tr><tr><td><span class="term"><em class="parameter"><code>stream</code></em>&#160;:</span></td><td> an existing stream which will be reused, or <code class="literal">NULL</code></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> A <font color="red">&lt;typename&gt;FILE&lt;/typename&gt;</font> pointer if the file was successfully   opened, or <code class="literal">NULL</code> if an error occurred.</td></tr></tbody></table></div><p>Since  2.6</p></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-Spawning-Processes.html"><b>&lt;&lt;&#160;Spawning Processes</b></a></td><td align="right"><a accesskey="n" href="glib-Shell-related-Utilities.html"><b>Shell-related Utilities&#160;&gt;&gt;</b></a></td></tr></table></body></html>

⌨️ 快捷键说明

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