<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="glib-File-Utilities">
<refmeta>
<refentrytitle role="top_of_page" id="glib-File-Utilities.top_of_page">File Utilities</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>File Utilities</refname>
<refpurpose>various file-related functions</refpurpose>
</refnamediv>

<refsect1 id="glib-File-Utilities.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GFileError"><returnvalue>GFileError</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-file-error-from-errno">g_file_error_from_errno</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-file-get-contents">g_file_get_contents</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-file-set-contents">g_file_set_contents</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-file-test">g_file_test</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mkstemp">g_mkstemp</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mkstemp-full">g_mkstemp_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-file-open-tmp">g_file_open_tmp</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-file-read-link">g_file_read_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mkdir-with-parents">g_mkdir_with_parents</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mkdtemp">g_mkdtemp</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mkdtemp-full">g_mkdtemp_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-dir-make-tmp">g_dir_make_tmp</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDir"><returnvalue>GDir</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-dir-open">g_dir_open</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-dir-read-name">g_dir_read_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-dir-rewind">g_dir_rewind</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-dir-close">g_dir_close</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GMappedFile"><returnvalue>GMappedFile</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mapped-file-new">g_mapped_file_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GMappedFile"><returnvalue>GMappedFile</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mapped-file-new-from-fd">g_mapped_file_new_from_fd</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GMappedFile"><returnvalue>GMappedFile</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mapped-file-ref">g_mapped_file_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mapped-file-unref">g_mapped_file_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mapped-file-free">g_mapped_file_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mapped-file-get-length">g_mapped_file_get_length</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mapped-file-get-contents">g_mapped_file_get_contents</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GBytes"><returnvalue>GBytes</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mapped-file-get-bytes">g_mapped_file_get_bytes</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-open">g_open</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-rename">g_rename</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mkdir">g_mkdir</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-stat">g_stat</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-lstat">g_lstat</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-unlink">g_unlink</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-remove">g_remove</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-rmdir">g_rmdir</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="FILE:CAPS"><returnvalue>FILE</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-fopen">g_fopen</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="FILE:CAPS"><returnvalue>FILE</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-freopen">g_freopen</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-fsync">g_fsync</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-chmod">g_chmod</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-access">g_access</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-creat">g_creat</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-chdir">g_chdir</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="int"><returnvalue>int</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-utime">g_utime</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-close">g_close</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-File-Utilities.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GFileError">GFileError</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-FILE-ERROR:CAPS">G_FILE_ERROR</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GFileTest">GFileTest</link></entry></row>

<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GDir">GDir</link></entry></row>

<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GMappedFile">GMappedFile</link></entry></row>

<row><entry role="typedef_keyword">typedef</entry><entry role="function_name"><link linkend="GStatBuf">GStatBuf</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="glib-File-Utilities.includes"><title>Includes</title><synopsis>#include &lt;glib.h&gt;
#include &lt;glib/gstdio.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
</synopsis></refsect1>

<refsect1 id="glib-File-Utilities.description" role="desc">
<title role="desc.title">Description</title>
<para>Do not use these APIs unless you are porting a POSIX application to Windows.
A more high-level file access API is provided as GIO — see the documentation
for <link linkend="GFile"><type>GFile</type></link>.</para>
<para>There is a group of functions which wrap the common POSIX functions
dealing with filenames (<link linkend="g-open"><function>g_open()</function></link>, <link linkend="g-rename"><function>g_rename()</function></link>, <link linkend="g-mkdir"><function>g_mkdir()</function></link>, <link linkend="g-stat"><function>g_stat()</function></link>,
<link linkend="g-unlink"><function>g_unlink()</function></link>, <link linkend="g-remove"><function>g_remove()</function></link>, <link linkend="g-fopen"><function>g_fopen()</function></link>, <link linkend="g-freopen"><function>g_freopen()</function></link>). The point of these
wrappers is to make it possible to handle file names with any Unicode
characters in them on Windows without having to use ifdefs and the
wide character API in the application code.</para>
<para>On some Unix systems, these APIs may be defined as identical to their POSIX
counterparts. For this reason, you must check for and include the necessary
header files (such as <literal>fcntl.h</literal>) before using functions like <link linkend="g-creat"><function>g_creat()</function></link>. You
must also define the relevant feature test macros.</para>
<para>The pathname argument should be in the GLib file name encoding.
On POSIX this is the actual on-disk encoding which might correspond
to the locale settings of the process (or the <literal>G_FILENAME_ENCODING</literal>
environment variable), or not.</para>
<para>On Windows the GLib file name encoding is UTF-8. Note that the
Microsoft C library does not use UTF-8, but has separate APIs for
current system code page and wide characters (UTF-16). The GLib
wrappers call the wide character API if present (on modern Windows
systems), otherwise convert to/from the system code page.</para>
<para>Another group of functions allows to open and read directories
in the GLib file name encoding. These are <link linkend="g-dir-open"><function>g_dir_open()</function></link>,
<link linkend="g-dir-read-name"><function>g_dir_read_name()</function></link>, <link linkend="g-dir-rewind"><function>g_dir_rewind()</function></link>, <link linkend="g-dir-close"><function>g_dir_close()</function></link>.</para>

</refsect1>
<refsect1 id="glib-File-Utilities.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="g-file-error-from-errno" role="function">
<title>g_file_error_from_errno&#160;()</title>
<indexterm zone="g-file-error-from-errno"><primary sortas="file_error_from_errno">g_file_error_from_errno</primary></indexterm>
<programlisting language="C"><link linkend="GFileError"><returnvalue>GFileError</returnvalue></link>
g_file_error_from_errno (<parameter><link linkend="gint"><type>gint</type></link> err_no</parameter>);</programlisting>
<para>Gets a <link linkend="GFileError"><type>GFileError</type></link> constant based on the passed-in <parameter>err_no</parameter>
.
For example, if you pass in <literal>EEXIST</literal> this function returns
<link linkend="G-FILE-ERROR-EXIST:CAPS"><type>G_FILE_ERROR_EXIST</type></link>. Unlike <literal>errno</literal> values, you can portably
assume that all <link linkend="GFileError"><type>GFileError</type></link> values will exist.</para>
<para>Normally a <link linkend="GFileError"><type>GFileError</type></link> value goes into a <link linkend="GError"><type>GError</type></link> returned
from a function that manipulates files. So you would use
<link linkend="g-file-error-from-errno"><function>g_file_error_from_errno()</function></link> when constructing a <link linkend="GError"><type>GError</type></link>.</para>
<refsect3 id="g-file-error-from-errno.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>err_no</para></entry>
<entry role="parameter_description"><para>an "errno" value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-file-error-from-errno.returns" role="returns">
<title>Returns</title>
<para> <link linkend="GFileError"><type>GFileError</type></link> corresponding to the given <parameter>errno</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="g-file-get-contents" role="function">
<title>g_file_get_contents&#160;()</title>
<indexterm zone="g-file-get-contents"><primary sortas="file_get_contents">g_file_get_contents</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_file_get_contents (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
                     <parameter><link linkend="gchar"><type>gchar</type></link> **contents</parameter>,
                     <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>,
                     <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Reads an entire file into allocated memory, with good error
checking.</para>
<para>If the call was successful, it returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> and sets <parameter>contents</parameter>
 to the file
contents and <parameter>length</parameter>
 to the length of the file contents in bytes. The string
stored in <parameter>contents</parameter>
 will be nul-terminated, so for text files you can pass
<link linkend="NULL:CAPS"><literal>NULL</literal></link> for the <parameter>length</parameter>
 argument. If the call was not successful, it returns
<link linkend="FALSE:CAPS"><literal>FALSE</literal></link> and sets <parameter>error</parameter>
. The error domain is <link linkend="G-FILE-ERROR:CAPS"><type>G_FILE_ERROR</type></link>. Possible error
codes are those in the <link linkend="GFileError"><type>GFileError</type></link> enumeration. In the error case,
<parameter>contents</parameter>
 is set to <link linkend="NULL:CAPS"><literal>NULL</literal></link> and <parameter>length</parameter>
 is set to zero.</para>
<refsect3 id="g-file-get-contents.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>name of a file to read contents from, in the GLib file name encoding. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>contents</para></entry>
<entry role="parameter_description"><para>location to store an allocated string, use <link linkend="g-free"><function>g_free()</function></link> to free
the returned string. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>array</acronym> length=length][<acronym>element-type</acronym> guint8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>location to store length in bytes of the contents, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-file-get-contents.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> on success, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if an error occurred</para>
</refsect3></refsect2>
<refsect2 id="g-file-set-contents" role="function" condition="since:2.8">
<title>g_file_set_contents&#160;()</title>
<indexterm zone="g-file-set-contents" role="2.8"><primary sortas="file_set_contents">g_file_set_contents</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_file_set_contents (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *contents</parameter>,
                     <parameter><link linkend="gssize"><type>gssize</type></link> length</parameter>,
                     <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Writes all of <parameter>contents</parameter>
 to a file named <parameter>filename</parameter>
, with good error checking.
If a file called <parameter>filename</parameter>
 already exists it will be overwritten.</para>
<para>This write is atomic in the sense that it is first written to a temporary
file which is then renamed to the final name. Notes:</para>
<itemizedlist>
<listitem>
<para>On UNIX, if <parameter>filename</parameter>
 already exists hard links to <parameter>filename</parameter>
 will break.
Also since the file is recreated, existing permissions, access control
lists, metadata etc. may be lost. If <parameter>filename</parameter>
 is a symbolic link,
the link itself will be replaced, not the linked file.</para>
</listitem>
<listitem>
<para>On UNIX, if <parameter>filename</parameter>
 already exists and is non-empty, and if the system
supports it (via a journalling filesystem or equivalent), the <link linkend="fsync"><function>fsync()</function></link>
call (or equivalent) will be used to ensure atomic replacement: <parameter>filename</parameter>

will contain either its old contents or <parameter>contents</parameter>
, even in the face of
system power loss, the disk being unsafely removed, etc.</para>
</listitem>
<listitem>
<para>On UNIX, if <parameter>filename</parameter>
 does not already exist or is empty, there is a
possibility that system power loss etc. after calling this function will
leave <parameter>filename</parameter>
 empty or full of NUL bytes, depending on the underlying
filesystem.</para>
</listitem>
<listitem>
<para>On Windows renaming a file will not remove an existing file with the
new name, so on Windows there is a race condition between the existing
file being removed and the temporary file being renamed.</para>
</listitem>
<listitem>
<para>On Windows there is no way to remove a file that is open to some
process, or mapped into memory. Thus, this function will fail if
<parameter>filename</parameter>
 already exists and is open.</para>
</listitem>
</itemizedlist>
<para>If the call was successful, it returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. If the call was not successful,
it returns <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> and sets <parameter>error</parameter>
. The error domain is <link linkend="G-FILE-ERROR:CAPS"><type>G_FILE_ERROR</type></link>.
Possible error codes are those in the <link linkend="GFileError"><type>GFileError</type></link> enumeration.</para>
<para>Note that the name for the temporary file is constructed by appending up
to 7 characters to <parameter>filename</parameter>
.</para>
<refsect3 id="g-file-set-contents.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>name of a file to write <parameter>contents</parameter>
to, in the GLib file name
encoding. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>contents</para></entry>
<entry role="parameter_description"><para>string to write to the file. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=length][<acronym>element-type</acronym> guint8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>length of <parameter>contents</parameter>
, or -1 if <parameter>contents</parameter>
is a nul-terminated string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-file-set-contents.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> on success, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if an error occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-file-test" role="function">
<title>g_file_test&#160;()</title>
<indexterm zone="g-file-test"><primary sortas="file_test">g_file_test</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_file_test (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
             <parameter><link linkend="GFileTest"><type>GFileTest</type></link> test</parameter>);</programlisting>
<para>Returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if any of the tests in the bitfield <parameter>test</parameter>
 are
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. For example, <literal>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)</literal>
will return <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file exists; the check whether it's a
directory doesn't matter since the existence test is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. With
the current set of available tests, there's no point passing in
more than one test at a time.</para>
<para>Apart from <link linkend="G-FILE-TEST-IS-SYMLINK:CAPS"><literal>G_FILE_TEST_IS_SYMLINK</literal></link> all tests follow symbolic links,
so for a symbolic link to a regular file <link linkend="g-file-test"><function>g_file_test()</function></link> will return
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link> for both <link linkend="G-FILE-TEST-IS-SYMLINK:CAPS"><literal>G_FILE_TEST_IS_SYMLINK</literal></link> and <link linkend="G-FILE-TEST-IS-REGULAR:CAPS"><literal>G_FILE_TEST_IS_REGULAR</literal></link>.</para>
<para>Note, that for a dangling symbolic link <link linkend="g-file-test"><function>g_file_test()</function></link> will return
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link> for <link linkend="G-FILE-TEST-IS-SYMLINK:CAPS"><literal>G_FILE_TEST_IS_SYMLINK</literal></link> and <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> for all other flags.</para>
<para>You should never use <link linkend="g-file-test"><function>g_file_test()</function></link> to test whether it is safe
to perform an operation, because there is always the possibility
of the condition changing before you actually perform the operation.
For example, you might think you could use <link linkend="G-FILE-TEST-IS-SYMLINK:CAPS"><literal>G_FILE_TEST_IS_SYMLINK</literal></link>
to know whether it is safe to write to a file without being
tricked into writing into a different location. It doesn't work!</para>
<informalexample><programlisting role="example"><![CDATA[
 // DON'T DO THIS
 if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) 
   {
     fd = g_open (filename, O_WRONLY);
     // write to fd
   }
]]></programlisting></informalexample>
<para></para>
<para>Another thing to note is that <link linkend="G-FILE-TEST-EXISTS:CAPS"><literal>G_FILE_TEST_EXISTS</literal></link> and
<link linkend="G-FILE-TEST-IS-EXECUTABLE:CAPS"><literal>G_FILE_TEST_IS_EXECUTABLE</literal></link> are implemented using the <link linkend="access"><function>access()</function></link>
system call. This usually doesn't matter, but if your program
is setuid or setgid it means that these tests will give you
the answer for the real user ID and group ID, rather than the
effective user ID and group ID.</para>
<para>On Windows, there are no symlinks, so testing for
<link linkend="G-FILE-TEST-IS-SYMLINK:CAPS"><literal>G_FILE_TEST_IS_SYMLINK</literal></link> will always return <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>. Testing for
<link linkend="G-FILE-TEST-IS-EXECUTABLE:CAPS"><literal>G_FILE_TEST_IS_EXECUTABLE</literal></link> will just check that the file exists and
its name indicates that it is executable, checking for well-known
extensions and those listed in the <literal>PATHEXT</literal> environment variable.</para>
<refsect3 id="g-file-test.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a filename to test in the
GLib file name encoding. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>test</para></entry>
<entry role="parameter_description"><para>bitfield of <link linkend="GFileTest"><type>GFileTest</type></link> flags</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-file-test.returns" role="returns">
<title>Returns</title>
<para> whether a test was <link linkend="TRUE:CAPS"><literal>TRUE</literal></link></para>
</refsect3></refsect2>
<refsect2 id="g-mkstemp" role="function">
<title>g_mkstemp&#160;()</title>
<indexterm zone="g-mkstemp"><primary sortas="mkstemp">g_mkstemp</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_mkstemp (<parameter><link linkend="gchar"><type>gchar</type></link> *tmpl</parameter>);</programlisting>
<para>Opens a temporary file. See the <link linkend="mkstemp"><function>mkstemp()</function></link> documentation
on most UNIX-like systems.</para>
<para>The parameter is a string that should follow the rules for
<link linkend="mkstemp"><function>mkstemp()</function></link> templates, i.e. contain the string "XXXXXX".
<link linkend="g-mkstemp"><function>g_mkstemp()</function></link> is slightly more flexible than <link linkend="mkstemp"><function>mkstemp()</function></link> in that the
sequence does not have to occur at the very end of the template.
The X string will be modified to form the name of a file that
didn't exist. The string should be in the GLib file name encoding.
Most importantly, on Windows it should be in UTF-8.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-mkstemp.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tmpl</para></entry>
<entry role="parameter_description"><para>template filename. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mkstemp.returns" role="returns">
<title>Returns</title>
<para> A file handle (as from <link linkend="open"><function>open()</function></link>) to the file
opened for reading and writing. The file is opened in binary
mode on platforms where there is a difference. The file handle
should be closed with <link linkend="close"><function>close()</function></link>. In case of errors, -1 is
returned and <link linkend="errno"><literal>errno</literal></link> will be set.</para>
</refsect3></refsect2>
<refsect2 id="g-mkstemp-full" role="function" condition="since:2.22">
<title>g_mkstemp_full&#160;()</title>
<indexterm zone="g-mkstemp-full" role="2.22"><primary sortas="mkstemp_full">g_mkstemp_full</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_mkstemp_full (<parameter><link linkend="gchar"><type>gchar</type></link> *tmpl</parameter>,
                <parameter><link linkend="gint"><type>gint</type></link> flags</parameter>,
                <parameter><link linkend="gint"><type>gint</type></link> mode</parameter>);</programlisting>
<para>Opens a temporary file. See the <link linkend="mkstemp"><function>mkstemp()</function></link> documentation
on most UNIX-like systems.</para>
<para>The parameter is a string that should follow the rules for
<link linkend="mkstemp"><function>mkstemp()</function></link> templates, i.e. contain the string "XXXXXX".
<link linkend="g-mkstemp-full"><function>g_mkstemp_full()</function></link> is slightly more flexible than <link linkend="mkstemp"><function>mkstemp()</function></link>
in that the sequence does not have to occur at the very end of the
template and you can pass a <parameter>mode</parameter>
 and additional <parameter>flags</parameter>
. The X
string will be modified to form the name of a file that didn't exist.
The string should be in the GLib file name encoding. Most importantly,
on Windows it should be in UTF-8.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-mkstemp-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tmpl</para></entry>
<entry role="parameter_description"><para>template filename. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>flags</para></entry>
<entry role="parameter_description"><para>flags to pass to an <link linkend="open"><function>open()</function></link> call in addition to O_EXCL
and O_CREAT, which are passed automatically</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>permissions to create the temporary file with</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mkstemp-full.returns" role="returns">
<title>Returns</title>
<para> A file handle (as from <link linkend="open"><function>open()</function></link>) to the file
opened for reading and writing. The file handle should be
closed with <link linkend="close"><function>close()</function></link>. In case of errors, -1 is returned
and <link linkend="errno"><literal>errno</literal></link> will be set.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.22">2.22</link></para></refsect2>
<refsect2 id="g-file-open-tmp" role="function">
<title>g_file_open_tmp&#160;()</title>
<indexterm zone="g-file-open-tmp"><primary sortas="file_open_tmp">g_file_open_tmp</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_file_open_tmp (<parameter>const <link linkend="gchar"><type>gchar</type></link> *tmpl</parameter>,
                 <parameter><link linkend="gchar"><type>gchar</type></link> **name_used</parameter>,
                 <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Opens a file for writing in the preferred directory for temporary
files (as returned by <link linkend="g-get-tmp-dir"><function>g_get_tmp_dir()</function></link>).</para>
<para><parameter>tmpl</parameter>
 should be a string in the GLib file name encoding containing
a sequence of six 'X' characters, as the parameter to <link linkend="g-mkstemp"><function>g_mkstemp()</function></link>.
However, unlike these functions, the template should only be a
basename, no directory components are allowed. If template is
<link linkend="NULL:CAPS"><literal>NULL</literal></link>, a default template is used.</para>
<para>Note that in contrast to <link linkend="g-mkstemp"><function>g_mkstemp()</function></link> (and <link linkend="mkstemp"><function>mkstemp()</function></link>) <parameter>tmpl</parameter>
 is not
modified, and might thus be a read-only literal string.</para>
<para>Upon success, and if <parameter>name_used</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>, the actual name used
is returned in <parameter>name_used</parameter>
. This string should be freed with <link linkend="g-free"><function>g_free()</function></link>
when not needed any longer. The returned name is in the GLib file
name encoding.</para>
<refsect3 id="g-file-open-tmp.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tmpl</para></entry>
<entry role="parameter_description"><para>Template for file name, as in
<link linkend="g-mkstemp"><function>g_mkstemp()</function></link>, basename only, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> for a default template. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename][<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>name_used</para></entry>
<entry role="parameter_description"><para>location to store actual name used,
or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-file-open-tmp.returns" role="returns">
<title>Returns</title>
<para> A file handle (as from <link linkend="open"><function>open()</function></link>) to the file opened for
reading and writing. The file is opened in binary mode on platforms
where there is a difference. The file handle should be closed with
<link linkend="close"><function>close()</function></link>. In case of errors, -1 is returned and <parameter>error</parameter>
will be set.</para>
</refsect3></refsect2>
<refsect2 id="g-file-read-link" role="function" condition="since:2.4">
<title>g_file_read_link&#160;()</title>
<indexterm zone="g-file-read-link" role="2.4"><primary sortas="file_read_link">g_file_read_link</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_file_read_link (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
                  <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Reads the contents of the symbolic link <parameter>filename</parameter>
 like the POSIX
<link linkend="readlink"><function>readlink()</function></link> function.  The returned string is in the encoding used
for filenames. Use <link linkend="g-filename-to-utf8"><function>g_filename_to_utf8()</function></link> to convert it to UTF-8.</para>
<refsect3 id="g-file-read-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>the symbolic link. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-file-read-link.returns" role="returns">
<title>Returns</title>
<para>A newly-allocated string with the contents of
the symbolic link, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if an error occurred. </para>
<para><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-mkdir-with-parents" role="function" condition="since:2.8">
<title>g_mkdir_with_parents&#160;()</title>
<indexterm zone="g-mkdir-with-parents" role="2.8"><primary sortas="mkdir_with_parents">g_mkdir_with_parents</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_mkdir_with_parents (<parameter>const <link linkend="gchar"><type>gchar</type></link> *pathname</parameter>,
                      <parameter><link linkend="gint"><type>gint</type></link> mode</parameter>);</programlisting>
<para>Create a directory if it doesn't already exist. Create intermediate
parent directories as needed, too.</para>
<refsect3 id="g-mkdir-with-parents.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>pathname</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>permissions to use for newly created directories</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mkdir-with-parents.returns" role="returns">
<title>Returns</title>
<para> 0 if the directory already exists, or was successfully
created. Returns -1 if an error occurred, with errno set.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-mkdtemp" role="function" condition="since:2.30">
<title>g_mkdtemp&#160;()</title>
<indexterm zone="g-mkdtemp" role="2.30"><primary sortas="mkdtemp">g_mkdtemp</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_mkdtemp (<parameter><link linkend="gchar"><type>gchar</type></link> *tmpl</parameter>);</programlisting>
<para>Creates a temporary directory. See the <link linkend="mkdtemp"><function>mkdtemp()</function></link> documentation
on most UNIX-like systems.</para>
<para>The parameter is a string that should follow the rules for
<link linkend="mkdtemp"><function>mkdtemp()</function></link> templates, i.e. contain the string "XXXXXX".
<link linkend="g-mkdtemp"><function>g_mkdtemp()</function></link> is slightly more flexible than <link linkend="mkdtemp"><function>mkdtemp()</function></link> in that the
sequence does not have to occur at the very end of the template.
The X string will be modified to form the name of a directory that
didn't exist.
The string should be in the GLib file name encoding. Most importantly,
on Windows it should be in UTF-8.</para>
<para>If you are going to be creating a temporary directory inside the
directory returned by <link linkend="g-get-tmp-dir"><function>g_get_tmp_dir()</function></link>, you might want to use
<link linkend="g-dir-make-tmp"><function>g_dir_make_tmp()</function></link> instead.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-mkdtemp.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tmpl</para></entry>
<entry role="parameter_description"><para>template directory name. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mkdtemp.returns" role="returns">
<title>Returns</title>
<para>A pointer to <parameter>tmpl</parameter>
, which has been
modified to hold the directory name.  In case of errors, <link linkend="NULL:CAPS"><literal>NULL</literal></link> is
returned and <link linkend="errno"><literal>errno</literal></link> will be set. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>type</acronym> filename]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.30">2.30</link></para></refsect2>
<refsect2 id="g-mkdtemp-full" role="function" condition="since:2.30">
<title>g_mkdtemp_full&#160;()</title>
<indexterm zone="g-mkdtemp-full" role="2.30"><primary sortas="mkdtemp_full">g_mkdtemp_full</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_mkdtemp_full (<parameter><link linkend="gchar"><type>gchar</type></link> *tmpl</parameter>,
                <parameter><link linkend="gint"><type>gint</type></link> mode</parameter>);</programlisting>
<para>Creates a temporary directory. See the <link linkend="mkdtemp"><function>mkdtemp()</function></link> documentation
on most UNIX-like systems.</para>
<para>The parameter is a string that should follow the rules for
<link linkend="mkdtemp"><function>mkdtemp()</function></link> templates, i.e. contain the string "XXXXXX".
<link linkend="g-mkdtemp-full"><function>g_mkdtemp_full()</function></link> is slightly more flexible than <link linkend="mkdtemp"><function>mkdtemp()</function></link> in that the
sequence does not have to occur at the very end of the template
and you can pass a <parameter>mode</parameter>
. The X string will be modified to form
the name of a directory that didn't exist. The string should be
in the GLib file name encoding. Most importantly, on Windows it
should be in UTF-8.</para>
<para>If you are going to be creating a temporary directory inside the
directory returned by <link linkend="g-get-tmp-dir"><function>g_get_tmp_dir()</function></link>, you might want to use
<link linkend="g-dir-make-tmp"><function>g_dir_make_tmp()</function></link> instead.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-mkdtemp-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tmpl</para></entry>
<entry role="parameter_description"><para>template directory name. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>permissions to create the temporary directory with</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mkdtemp-full.returns" role="returns">
<title>Returns</title>
<para>A pointer to <parameter>tmpl</parameter>
, which has been
modified to hold the directory name. In case of errors, <link linkend="NULL:CAPS"><literal>NULL</literal></link> is
returned, and <link linkend="errno"><literal>errno</literal></link> will be set. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>type</acronym> filename]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.30">2.30</link></para></refsect2>
<refsect2 id="g-dir-make-tmp" role="function" condition="since:2.30">
<title>g_dir_make_tmp&#160;()</title>
<indexterm zone="g-dir-make-tmp" role="2.30"><primary sortas="dir_make_tmp">g_dir_make_tmp</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_dir_make_tmp (<parameter>const <link linkend="gchar"><type>gchar</type></link> *tmpl</parameter>,
                <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Creates a subdirectory in the preferred directory for temporary
files (as returned by <link linkend="g-get-tmp-dir"><function>g_get_tmp_dir()</function></link>).</para>
<para><parameter>tmpl</parameter>
 should be a string in the GLib file name encoding containing
a sequence of six 'X' characters, as the parameter to <link linkend="g-mkstemp"><function>g_mkstemp()</function></link>.
However, unlike these functions, the template should only be a
basename, no directory components are allowed. If template is
<link linkend="NULL:CAPS"><literal>NULL</literal></link>, a default template is used.</para>
<para>Note that in contrast to <link linkend="g-mkdtemp"><function>g_mkdtemp()</function></link> (and <link linkend="mkdtemp"><function>mkdtemp()</function></link>) <parameter>tmpl</parameter>
 is not
modified, and might thus be a read-only literal string.</para>
<refsect3 id="g-dir-make-tmp.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tmpl</para></entry>
<entry role="parameter_description"><para>Template for directory name,
as in <link linkend="g-mkdtemp"><function>g_mkdtemp()</function></link>, basename only, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> for a default template. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename][<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-dir-make-tmp.returns" role="returns">
<title>Returns</title>
<para>The actual name used. This string
should be freed with <link linkend="g-free"><function>g_free()</function></link> when not needed any longer and is
is in the GLib file name encoding. In case of errors, <link linkend="NULL:CAPS"><literal>NULL</literal></link> is
returned and <parameter>error</parameter>
will be set. </para>
<para><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.30">2.30</link></para></refsect2>
<refsect2 id="g-dir-open" role="function">
<title>g_dir_open&#160;()</title>
<indexterm zone="g-dir-open"><primary sortas="dir_open">g_dir_open</primary></indexterm>
<programlisting language="C"><link linkend="GDir"><returnvalue>GDir</returnvalue></link>&#160;*
g_dir_open (<parameter>const <link linkend="gchar"><type>gchar</type></link> *path</parameter>,
            <parameter><link linkend="guint"><type>guint</type></link> flags</parameter>,
            <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Opens a directory for reading. The names of the files in the
directory can then be retrieved using <link linkend="g-dir-read-name"><function>g_dir_read_name()</function></link>.  Note
that the ordering is not defined.</para>
<refsect3 id="g-dir-open.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>path</para></entry>
<entry role="parameter_description"><para>the path to the directory you are interested in. On Unix
in the on-disk encoding. On Windows in UTF-8</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>flags</para></entry>
<entry role="parameter_description"><para>Currently must be set to 0. Reserved for future use.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>.
If non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>, an error will be set if and only if
<link linkend="g-dir-open"><function>g_dir_open()</function></link> fails.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-dir-open.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GDir"><type>GDir</type></link> on success, <link linkend="NULL:CAPS"><literal>NULL</literal></link> on failure.
If non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>, you must free the result with <link linkend="g-dir-close"><function>g_dir_close()</function></link>
when you are finished with it.</para>
</refsect3></refsect2>
<refsect2 id="g-dir-read-name" role="function">
<title>g_dir_read_name&#160;()</title>
<indexterm zone="g-dir-read-name"><primary sortas="dir_read_name">g_dir_read_name</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_dir_read_name (<parameter><link linkend="GDir"><type>GDir</type></link> *dir</parameter>);</programlisting>
<para>Retrieves the name of another entry in the directory, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>.
The order of entries returned from this function is not defined,
and may vary by file system or other operating-system dependent
factors.</para>
<para><link linkend="NULL:CAPS"><literal>NULL</literal></link> may also be returned in case of errors. On Unix, you can
check <literal>errno</literal> to find out if <link linkend="NULL:CAPS"><literal>NULL</literal></link> was returned because of an error.</para>
<para>On Unix, the '.' and '..' entries are omitted, and the returned
name is in the on-disk encoding.</para>
<para>On Windows, as is true of all GLib functions which operate on
filenames, the returned name is in UTF-8.</para>
<refsect3 id="g-dir-read-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dir</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDir"><type>GDir</type></link>* created by <link linkend="g-dir-open"><function>g_dir_open()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-dir-read-name.returns" role="returns">
<title>Returns</title>
<para>The entry's name or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if there are no
more entries. The return value is owned by GLib and
must not be modified or freed. </para>
<para><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-dir-rewind" role="function">
<title>g_dir_rewind&#160;()</title>
<indexterm zone="g-dir-rewind"><primary sortas="dir_rewind">g_dir_rewind</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_dir_rewind (<parameter><link linkend="GDir"><type>GDir</type></link> *dir</parameter>);</programlisting>
<para>Resets the given directory. The next call to <link linkend="g-dir-read-name"><function>g_dir_read_name()</function></link>
will return the first entry again.</para>
<refsect3 id="g-dir-rewind.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dir</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDir"><type>GDir</type></link>* created by <link linkend="g-dir-open"><function>g_dir_open()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-dir-close" role="function">
<title>g_dir_close&#160;()</title>
<indexterm zone="g-dir-close"><primary sortas="dir_close">g_dir_close</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_dir_close (<parameter><link linkend="GDir"><type>GDir</type></link> *dir</parameter>);</programlisting>
<para>Closes the directory and deallocates all related resources.</para>
<refsect3 id="g-dir-close.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dir</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDir"><type>GDir</type></link>* created by <link linkend="g-dir-open"><function>g_dir_open()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-mapped-file-new" role="function" condition="since:2.8">
<title>g_mapped_file_new&#160;()</title>
<indexterm zone="g-mapped-file-new" role="2.8"><primary sortas="mapped_file_new">g_mapped_file_new</primary></indexterm>
<programlisting language="C"><link linkend="GMappedFile"><returnvalue>GMappedFile</returnvalue></link>&#160;*
g_mapped_file_new (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
                   <parameter><link linkend="gboolean"><type>gboolean</type></link> writable</parameter>,
                   <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Maps a file into memory. On UNIX, this is using the <link linkend="mmap"><function>mmap()</function></link> function.</para>
<para>If <parameter>writable</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.</para>
<para>Note that modifications of the underlying file might affect the contents
of the <link linkend="GMappedFile"><type>GMappedFile</type></link>. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using <link linkend="g-file-set-contents"><function>g_file_set_contents()</function></link>).</para>
<para>If <parameter>filename</parameter>
 is the name of an empty, regular file, the function
will successfully return an empty <link linkend="GMappedFile"><type>GMappedFile</type></link>. In other cases of
size 0 (e.g. device files such as /dev/null), <parameter>error</parameter>
 will be set
to the <link linkend="GFileError"><type>GFileError</type></link> value <link linkend="G-FILE-ERROR-INVAL:CAPS"><type>G_FILE_ERROR_INVAL</type></link>.</para>
<refsect3 id="g-mapped-file-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>The path of the file to load, in the GLib
filename encoding. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>writable</para></entry>
<entry role="parameter_description"><para>whether the mapping should be writable</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mapped-file-new.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GMappedFile"><type>GMappedFile</type></link> which must be unref'd
with <link linkend="g-mapped-file-unref"><function>g_mapped_file_unref()</function></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the mapping failed.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-mapped-file-new-from-fd" role="function" condition="since:2.32">
<title>g_mapped_file_new_from_fd&#160;()</title>
<indexterm zone="g-mapped-file-new-from-fd" role="2.32"><primary sortas="mapped_file_new_from_fd">g_mapped_file_new_from_fd</primary></indexterm>
<programlisting language="C"><link linkend="GMappedFile"><returnvalue>GMappedFile</returnvalue></link>&#160;*
g_mapped_file_new_from_fd (<parameter><link linkend="gint"><type>gint</type></link> fd</parameter>,
                           <parameter><link linkend="gboolean"><type>gboolean</type></link> writable</parameter>,
                           <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Maps a file into memory. On UNIX, this is using the <link linkend="mmap"><function>mmap()</function></link> function.</para>
<para>If <parameter>writable</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.</para>
<para>Note that modifications of the underlying file might affect the contents
of the <link linkend="GMappedFile"><type>GMappedFile</type></link>. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using <link linkend="g-file-set-contents"><function>g_file_set_contents()</function></link>).</para>
<refsect3 id="g-mapped-file-new-from-fd.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>fd</para></entry>
<entry role="parameter_description"><para>The file descriptor of the file to load</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>writable</para></entry>
<entry role="parameter_description"><para>whether the mapping should be writable</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for a <link linkend="GError"><type>GError</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mapped-file-new-from-fd.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GMappedFile"><type>GMappedFile</type></link> which must be unref'd
with <link linkend="g-mapped-file-unref"><function>g_mapped_file_unref()</function></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the mapping failed.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.32">2.32</link></para></refsect2>
<refsect2 id="g-mapped-file-ref" role="function" condition="since:2.22">
<title>g_mapped_file_ref&#160;()</title>
<indexterm zone="g-mapped-file-ref" role="2.22"><primary sortas="mapped_file_ref">g_mapped_file_ref</primary></indexterm>
<programlisting language="C"><link linkend="GMappedFile"><returnvalue>GMappedFile</returnvalue></link>&#160;*
g_mapped_file_ref (<parameter><link linkend="GMappedFile"><type>GMappedFile</type></link> *file</parameter>);</programlisting>
<para>Increments the reference count of <parameter>file</parameter>
 by one.  It is safe to call
this function from any thread.</para>
<refsect3 id="g-mapped-file-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>file</para></entry>
<entry role="parameter_description"><para>a <link linkend="GMappedFile"><type>GMappedFile</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mapped-file-ref.returns" role="returns">
<title>Returns</title>
<para> the passed in <link linkend="GMappedFile"><type>GMappedFile</type></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.22">2.22</link></para></refsect2>
<refsect2 id="g-mapped-file-unref" role="function">
<title>g_mapped_file_unref&#160;()</title>
<indexterm zone="g-mapped-file-unref"><primary sortas="mapped_file_unref">g_mapped_file_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_mapped_file_unref (<parameter><link linkend="GMappedFile"><type>GMappedFile</type></link> *file</parameter>);</programlisting>
<para>Decrements the reference count of <parameter>file</parameter>
 by one.  If the reference count
drops to 0, unmaps the buffer of <parameter>file</parameter>
 and frees it.</para>
<para>It is safe to call this function from any thread.</para>
<para>Since 2.22</para>
<refsect3 id="g-mapped-file-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>file</para></entry>
<entry role="parameter_description"><para>a <link linkend="GMappedFile"><type>GMappedFile</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-mapped-file-free" role="function" condition="deprecated:2.22: Use g_mapped_file_unref() instead.|since:2.8">
<title>g_mapped_file_free&#160;()</title>
<indexterm zone="g-mapped-file-free" role="deprecated"><primary sortas="mapped_file_free">g_mapped_file_free</primary></indexterm><indexterm zone="g-mapped-file-free" role="2.8"><primary sortas="mapped_file_free">g_mapped_file_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_mapped_file_free (<parameter><link linkend="GMappedFile"><type>GMappedFile</type></link> *file</parameter>);</programlisting>
<warning><para><literal>g_mapped_file_free</literal> has been deprecated since version 2.22 and should not be used in newly-written code.</para> <para>Use <link linkend="g-mapped-file-unref"><function>g_mapped_file_unref()</function></link> instead.</para>
</warning>
<para>This call existed before <link linkend="GMappedFile"><type>GMappedFile</type></link> had refcounting and is currently
exactly the same as <link linkend="g-mapped-file-unref"><function>g_mapped_file_unref()</function></link>.</para>
<refsect3 id="g-mapped-file-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>file</para></entry>
<entry role="parameter_description"><para>a <link linkend="GMappedFile"><type>GMappedFile</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-mapped-file-get-length" role="function" condition="since:2.8">
<title>g_mapped_file_get_length&#160;()</title>
<indexterm zone="g-mapped-file-get-length" role="2.8"><primary sortas="mapped_file_get_length">g_mapped_file_get_length</primary></indexterm>
<programlisting language="C"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
g_mapped_file_get_length (<parameter><link linkend="GMappedFile"><type>GMappedFile</type></link> *file</parameter>);</programlisting>
<para>Returns the length of the contents of a <link linkend="GMappedFile"><type>GMappedFile</type></link>.</para>
<refsect3 id="g-mapped-file-get-length.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>file</para></entry>
<entry role="parameter_description"><para>a <link linkend="GMappedFile"><type>GMappedFile</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mapped-file-get-length.returns" role="returns">
<title>Returns</title>
<para> the length of the contents of <parameter>file</parameter>
.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-mapped-file-get-contents" role="function" condition="since:2.8">
<title>g_mapped_file_get_contents&#160;()</title>
<indexterm zone="g-mapped-file-get-contents" role="2.8"><primary sortas="mapped_file_get_contents">g_mapped_file_get_contents</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_mapped_file_get_contents (<parameter><link linkend="GMappedFile"><type>GMappedFile</type></link> *file</parameter>);</programlisting>
<para>Returns the contents of a <link linkend="GMappedFile"><type>GMappedFile</type></link>. </para>
<para>Note that the contents may not be zero-terminated,
even if the <link linkend="GMappedFile"><type>GMappedFile</type></link> is backed by a text file.</para>
<para>If the file is empty then <link linkend="NULL:CAPS"><literal>NULL</literal></link> is returned.</para>
<refsect3 id="g-mapped-file-get-contents.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>file</para></entry>
<entry role="parameter_description"><para>a <link linkend="GMappedFile"><type>GMappedFile</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mapped-file-get-contents.returns" role="returns">
<title>Returns</title>
<para> the contents of <parameter>file</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-mapped-file-get-bytes" role="function" condition="since:2.34">
<title>g_mapped_file_get_bytes&#160;()</title>
<indexterm zone="g-mapped-file-get-bytes" role="2.34"><primary sortas="mapped_file_get_bytes">g_mapped_file_get_bytes</primary></indexterm>
<programlisting language="C"><link linkend="GBytes"><returnvalue>GBytes</returnvalue></link>&#160;*
g_mapped_file_get_bytes (<parameter><link linkend="GMappedFile"><type>GMappedFile</type></link> *file</parameter>);</programlisting>
<para>Creates a new <link linkend="GBytes"><type>GBytes</type></link> which references the data mapped from <parameter>file</parameter>
.
The mapped contents of the file must not be modified after creating this
bytes object, because a <link linkend="GBytes"><type>GBytes</type></link> should be immutable.</para>
<refsect3 id="g-mapped-file-get-bytes.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>file</para></entry>
<entry role="parameter_description"><para>a <link linkend="GMappedFile"><type>GMappedFile</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mapped-file-get-bytes.returns" role="returns">
<title>Returns</title>
<para>A newly allocated <link linkend="GBytes"><type>GBytes</type></link> referencing data
from <parameter>file</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.34">2.34</link></para></refsect2>
<refsect2 id="g-open" role="function" condition="since:2.6">
<title>g_open&#160;()</title>
<indexterm zone="g-open" role="2.6"><primary sortas="open">g_open</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_open (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
        <parameter><link linkend="int"><type>int</type></link> flags</parameter>,
        <parameter><link linkend="int"><type>int</type></link> mode</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="open"><function>open()</function></link> function. The <link linkend="open"><function>open()</function></link> function is
used to convert a pathname into a file descriptor.</para>
<para>On POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements <link linkend="open"><function>open()</function></link> and
file descriptors. The actual Win32 API for opening files is quite
different, see MSDN documentation for <link linkend="CreateFile"><function>CreateFile()</function></link>. The Win32 API
uses file handles, which are more randomish integers, not small
integers like file descriptors.</para>
<para>Because file descriptors are specific to the C library on Windows,
the file descriptor returned by this function makes sense only to
functions in the same C library. Thus if the GLib-using code uses a
different C library than GLib does, the file descriptor returned by
this function cannot be passed to C library functions like <link linkend="write"><function>write()</function></link>
or <link linkend="read"><function>read()</function></link>.</para>
<para>See your C library manual for more details about <link linkend="open"><function>open()</function></link>.</para>
<refsect3 id="g-open.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>flags</para></entry>
<entry role="parameter_description"><para>as in <link linkend="open"><function>open()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>as in <link linkend="open"><function>open()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-open.returns" role="returns">
<title>Returns</title>
<para> a new file descriptor, or -1 if an error occurred.
The return value can be used exactly like the return value
from <link linkend="open"><function>open()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-rename" role="function" condition="since:2.6">
<title>g_rename&#160;()</title>
<indexterm zone="g-rename" role="2.6"><primary sortas="rename">g_rename</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_rename (<parameter>const <link linkend="gchar"><type>gchar</type></link> *oldfilename</parameter>,
          <parameter>const <link linkend="gchar"><type>gchar</type></link> *newfilename</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="rename"><function>rename()</function></link> function. The <link linkend="rename"><function>rename()</function></link> function 
renames a file, moving it between directories if required.</para>
<para>See your C library manual for more details about how <link linkend="rename"><function>rename()</function></link> works
on your system. It is not possible in general on Windows to rename
a file that is open to some process.</para>
<refsect3 id="g-rename.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>oldfilename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>newfilename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-rename.returns" role="returns">
<title>Returns</title>
<para> 0 if the renaming succeeded, -1 if an error occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-mkdir" role="function" condition="since:2.6">
<title>g_mkdir&#160;()</title>
<indexterm zone="g-mkdir" role="2.6"><primary sortas="mkdir">g_mkdir</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_mkdir (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
         <parameter><link linkend="int"><type>int</type></link> mode</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="mkdir"><function>mkdir()</function></link> function. The <link linkend="mkdir"><function>mkdir()</function></link> function 
attempts to create a directory with the given name and permissions.
The mode argument is ignored on Windows.</para>
<para>See your C library manual for more details about <link linkend="mkdir"><function>mkdir()</function></link>.</para>
<refsect3 id="g-mkdir.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>permissions to use for the newly created directory</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-mkdir.returns" role="returns">
<title>Returns</title>
<para> 0 if the directory was successfully created, -1 if an error
occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-stat" role="function" condition="since:2.6">
<title>g_stat&#160;()</title>
<indexterm zone="g-stat" role="2.6"><primary sortas="stat">g_stat</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_stat (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
        <parameter><link linkend="GStatBuf"><type>GStatBuf</type></link> *buf</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="stat"><function>stat()</function></link> function. The <link linkend="stat"><function>stat()</function></link> function
returns information about a file. On Windows the <link linkend="stat"><function>stat()</function></link> function in
the C library checks only the FAT-style READONLY attribute and does
not look at the ACL at all. Thus on Windows the protection bits in
the <parameter>st_mode</parameter>
 field are a fabrication of little use.</para>
<para>On Windows the Microsoft C libraries have several variants of the
stat struct and <link linkend="stat"><function>stat()</function></link> function with names like <link linkend="stat"><function>_stat()</function></link>, <link linkend="stat32"><function>_stat32()</function></link>,
<link linkend="stat32i64"><function>_stat32i64()</function></link> and <link linkend="stat64i32"><function>_stat64i32()</function></link>. The one used here is for 32-bit code
the one with 32-bit size and time fields, specifically called <link linkend="stat32"><function>_stat32()</function></link>.</para>
<para>In Microsoft's compiler, by default struct stat means one with
64-bit time fields while in MinGW struct stat is the legacy one
with 32-bit fields. To hopefully clear up this messs, the gstdio.h
header defines a type <link linkend="GStatBuf"><type>GStatBuf</type></link> which is the appropriate struct type
depending on the platform and/or compiler being used. On POSIX it
is just struct stat, but note that even on POSIX platforms, <link linkend="stat"><function>stat()</function></link>
might be a macro.</para>
<para>See your C library manual for more details about <link linkend="stat"><function>stat()</function></link>.</para>
<refsect3 id="g-stat.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>buf</para></entry>
<entry role="parameter_description"><para>a pointer to a stat struct, which will be filled with the file
information</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-stat.returns" role="returns">
<title>Returns</title>
<para> 0 if the information was successfully retrieved,
-1 if an error occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-lstat" role="function" condition="since:2.6">
<title>g_lstat&#160;()</title>
<indexterm zone="g-lstat" role="2.6"><primary sortas="lstat">g_lstat</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_lstat (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
         <parameter><link linkend="GStatBuf"><type>GStatBuf</type></link> *buf</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="lstat"><function>lstat()</function></link> function. The <link linkend="lstat"><function>lstat()</function></link> function is
like <link linkend="stat"><function>stat()</function></link> except that in the case of symbolic links, it returns
information about the symbolic link itself and not the file that it
refers to. If the system does not support symbolic links <link linkend="g-lstat"><function>g_lstat()</function></link>
is identical to <link linkend="g-stat"><function>g_stat()</function></link>.</para>
<para>See your C library manual for more details about <link linkend="lstat"><function>lstat()</function></link>.</para>
<refsect3 id="g-lstat.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>buf</para></entry>
<entry role="parameter_description"><para>a pointer to a stat struct, which will be filled with the file
information</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-lstat.returns" role="returns">
<title>Returns</title>
<para> 0 if the information was successfully retrieved,
-1 if an error occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-unlink" role="function" condition="since:2.6">
<title>g_unlink&#160;()</title>
<indexterm zone="g-unlink" role="2.6"><primary sortas="unlink">g_unlink</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_unlink (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="unlink"><function>unlink()</function></link> function. The <link linkend="unlink"><function>unlink()</function></link> 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 the
file is freed.</para>
<para>See your C library manual for more details about <link linkend="unlink"><function>unlink()</function></link>. Note
that on Windows, it is in general not possible to delete files that
are open to some process, or mapped into memory.</para>
<refsect3 id="g-unlink.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-unlink.returns" role="returns">
<title>Returns</title>
<para> 0 if the name was successfully deleted, -1 if an error
occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-remove" role="function" condition="since:2.6">
<title>g_remove&#160;()</title>
<indexterm zone="g-remove" role="2.6"><primary sortas="remove">g_remove</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_remove (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="remove"><function>remove()</function></link> function. The <link linkend="remove"><function>remove()</function></link> function
deletes a name from the filesystem.</para>
<para>See your C library manual for more details about how <link linkend="remove"><function>remove()</function></link> works
on your system. On Unix, <link linkend="remove"><function>remove()</function></link> removes also directories, as it
calls <link linkend="unlink"><function>unlink()</function></link> for files and <link linkend="rmdir"><function>rmdir()</function></link> for directories. On Windows,
although <link linkend="remove"><function>remove()</function></link> in the C library only works for files, this
function tries first <link linkend="remove"><function>remove()</function></link> and then if that fails <link linkend="rmdir"><function>rmdir()</function></link>, and
thus works for both files and directories. Note however, that on
Windows, it is in general not possible to remove a file that is
open to some process, or mapped into memory.</para>
<para>If this function fails on Windows you can't infer too much from the
errno value. <link linkend="rmdir"><function>rmdir()</function></link> is tried regardless of what caused <link linkend="remove"><function>remove()</function></link> to
fail. Any errno value set by <link linkend="remove"><function>remove()</function></link> will be overwritten by that
set by <link linkend="rmdir"><function>rmdir()</function></link>.</para>
<refsect3 id="g-remove.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-remove.returns" role="returns">
<title>Returns</title>
<para> 0 if the file was successfully removed, -1 if an error
occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-rmdir" role="function" condition="since:2.6">
<title>g_rmdir&#160;()</title>
<indexterm zone="g-rmdir" role="2.6"><primary sortas="rmdir">g_rmdir</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_rmdir (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="rmdir"><function>rmdir()</function></link> function. The <link linkend="rmdir"><function>rmdir()</function></link> function
deletes a directory from the filesystem.</para>
<para>See your C library manual for more details about how <link linkend="rmdir"><function>rmdir()</function></link> works
on your system.</para>
<refsect3 id="g-rmdir.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-rmdir.returns" role="returns">
<title>Returns</title>
<para> 0 if the directory was successfully removed, -1 if an error
occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-fopen" role="function" condition="since:2.6">
<title>g_fopen&#160;()</title>
<indexterm zone="g-fopen" role="2.6"><primary sortas="fopen">g_fopen</primary></indexterm>
<programlisting language="C"><link linkend="FILE:CAPS"><returnvalue>FILE</returnvalue></link>&#160;*
g_fopen (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
         <parameter>const <link linkend="gchar"><type>gchar</type></link> *mode</parameter>);</programlisting>
<para>A wrapper for the stdio <literal><link linkend="fopen"><function>fopen()</function></link></literal> function. The <literal><link linkend="fopen"><function>fopen()</function></link></literal> function
opens a file and associates a new stream with it.</para>
<para>Because file descriptors are specific to the C library on Windows,
and a file descriptor is part of the <literal>FILE</literal> struct, the <literal>FILE*</literal> returned
by this function makes sense only to functions in the same C library.
Thus if the GLib-using code uses a different C library than GLib does,
the FILE* returned by this function cannot be passed to C library
functions like <literal><link linkend="fprintf"><function>fprintf()</function></link></literal> or <literal><link linkend="fread"><function>fread()</function></link></literal>.</para>
<para>See your C library manual for more details about <literal><link linkend="fopen"><function>fopen()</function></link></literal>.</para>
<para>As <literal><link linkend="close"><function>close()</function></link></literal> and <literal><link linkend="fclose"><function>fclose()</function></link></literal> are part of the C library, this implies that it is
currently impossible to close a file if the application C library and the C library
used by GLib are different. Convenience functions like <link linkend="g-file-set-contents"><function>g_file_set_contents()</function></link>
avoid this problem.</para>
<refsect3 id="g-fopen.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>a string describing the mode in which the file should be opened</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-fopen.returns" role="returns">
<title>Returns</title>
<para> A <literal>FILE*</literal> if the file was successfully opened, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if
an error occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-freopen" role="function" condition="since:2.6">
<title>g_freopen&#160;()</title>
<indexterm zone="g-freopen" role="2.6"><primary sortas="freopen">g_freopen</primary></indexterm>
<programlisting language="C"><link linkend="FILE:CAPS"><returnvalue>FILE</returnvalue></link>&#160;*
g_freopen (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
           <parameter>const <link linkend="gchar"><type>gchar</type></link> *mode</parameter>,
           <parameter><link linkend="FILE:CAPS"><type>FILE</type></link> *stream</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="freopen"><function>freopen()</function></link> function. The <link linkend="freopen"><function>freopen()</function></link> function
opens a file and associates it with an existing stream.</para>
<para>See your C library manual for more details about <link linkend="freopen"><function>freopen()</function></link>.</para>
<refsect3 id="g-freopen.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>a string describing the mode in which the file should be  opened</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>stream</para></entry>
<entry role="parameter_description"><para>an existing stream which will be reused, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-freopen.returns" role="returns">
<title>Returns</title>
<para> A FILE* if the file was successfully opened, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if
an error occurred.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="g-fsync" role="function" condition="since:2.64">
<title>g_fsync&#160;()</title>
<indexterm zone="g-fsync" role="2.64"><primary sortas="fsync">g_fsync</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_fsync (<parameter><link linkend="gint"><type>gint</type></link> fd</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="fsync"><function>fsync()</function></link> function (<link linkend="commit"><function>_commit()</function></link> on Windows).
The <link linkend="fsync"><function>fsync()</function></link> function is used to synchronize a file's in-core
state with that of the disk.</para>
<para>See the C library manual for more details about <link linkend="fsync"><function>fsync()</function></link>.</para>
<refsect3 id="g-fsync.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>fd</para></entry>
<entry role="parameter_description"><para>a file descriptor</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-fsync.returns" role="returns">
<title>Returns</title>
<para> 0 on success, or -1 if an error occurred.
The return value can be used exactly like the return value from <link linkend="fsync"><function>fsync()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.64">2.64</link></para></refsect2>
<refsect2 id="g-chmod" role="function" condition="since:2.8">
<title>g_chmod&#160;()</title>
<indexterm zone="g-chmod" role="2.8"><primary sortas="chmod">g_chmod</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_chmod (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
         <parameter><link linkend="int"><type>int</type></link> mode</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="chmod"><function>chmod()</function></link> function. The <link linkend="chmod"><function>chmod()</function></link> function is
used to set the permissions of a file system object.</para>
<para>On Windows the file protection mechanism is not at all POSIX-like,
and the underlying <link linkend="chmod"><function>chmod()</function></link> function in the C library just sets or
clears the FAT-style READONLY attribute. It does not touch any
ACL. Software that needs to manage file permissions on Windows
exactly should use the Win32 API.</para>
<para>See your C library manual for more details about <link linkend="chmod"><function>chmod()</function></link>.</para>
<refsect3 id="g-chmod.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>as in <link linkend="chmod"><function>chmod()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-chmod.returns" role="returns">
<title>Returns</title>
<para> 0 if the operation succeeded, -1 on error</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-access" role="function" condition="since:2.8">
<title>g_access&#160;()</title>
<indexterm zone="g-access" role="2.8"><primary sortas="access">g_access</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_access (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
          <parameter><link linkend="int"><type>int</type></link> mode</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="access"><function>access()</function></link> function. This function is used to
test a pathname for one or several of read, write or execute
permissions, or just existence.</para>
<para>On Windows, the file protection mechanism is not at all POSIX-like,
and the underlying function in the C library only checks the
FAT-style READONLY attribute, and does not look at the ACL of a
file at all. This function is this in practise almost useless on
Windows. Software that needs to handle file permissions on Windows
more exactly should use the Win32 API.</para>
<para>See your C library manual for more details about <link linkend="access"><function>access()</function></link>.</para>
<refsect3 id="g-access.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>as in <link linkend="access"><function>access()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-access.returns" role="returns">
<title>Returns</title>
<para> zero if the pathname refers to an existing file system
object that has all the tested permissions, or -1 otherwise
or on error.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-creat" role="function" condition="since:2.8">
<title>g_creat&#160;()</title>
<indexterm zone="g-creat" role="2.8"><primary sortas="creat">g_creat</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_creat (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
         <parameter><link linkend="int"><type>int</type></link> mode</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="creat"><function>creat()</function></link> function. The <link linkend="creat"><function>creat()</function></link> function is
used to convert a pathname into a file descriptor, creating a file
if necessary.</para>
<para>On POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements <link linkend="creat"><function>creat()</function></link> and
file descriptors. The actual Windows API for opening files is
different, see MSDN documentation for <link linkend="CreateFile"><function>CreateFile()</function></link>. The Win32 API
uses file handles, which are more randomish integers, not small
integers like file descriptors.</para>
<para>Because file descriptors are specific to the C library on Windows,
the file descriptor returned by this function makes sense only to
functions in the same C library. Thus if the GLib-using code uses a
different C library than GLib does, the file descriptor returned by
this function cannot be passed to C library functions like <link linkend="write"><function>write()</function></link>
or <link linkend="read"><function>read()</function></link>.</para>
<para>See your C library manual for more details about <link linkend="creat"><function>creat()</function></link>.</para>
<refsect3 id="g-creat.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>as in <link linkend="creat"><function>creat()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-creat.returns" role="returns">
<title>Returns</title>
<para> a new file descriptor, or -1 if an error occurred.
The return value can be used exactly like the return value
from <link linkend="creat"><function>creat()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-chdir" role="function" condition="since:2.8">
<title>g_chdir&#160;()</title>
<indexterm zone="g-chdir" role="2.8"><primary sortas="chdir">g_chdir</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_chdir (<parameter>const <link linkend="gchar"><type>gchar</type></link> *path</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="chdir"><function>chdir()</function></link> function. The function changes the
current directory of the process to <parameter>path</parameter>
.</para>
<para>See your C library manual for more details about <link linkend="chdir"><function>chdir()</function></link>.</para>
<refsect3 id="g-chdir.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>path</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-chdir.returns" role="returns">
<title>Returns</title>
<para> 0 on success, -1 if an error occurred.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.8">2.8</link></para></refsect2>
<refsect2 id="g-utime" role="function" condition="since:2.18">
<title>g_utime&#160;()</title>
<indexterm zone="g-utime" role="2.18"><primary sortas="utime">g_utime</primary></indexterm>
<programlisting language="C"><link linkend="int"><returnvalue>int</returnvalue></link>
g_utime (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
         <parameter><type>struct utimbuf</type> *utb</parameter>);</programlisting>
<para>A wrapper for the POSIX <link linkend="utime"><function>utime()</function></link> function. The <link linkend="utime"><function>utime()</function></link> function
sets the access and modification timestamps of a file.</para>
<para>See your C library manual for more details about how <link linkend="utime"><function>utime()</function></link> works
on your system.</para>
<refsect3 id="g-utime.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>a pathname in the GLib file name encoding
(UTF-8 on Windows). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>utb</para></entry>
<entry role="parameter_description"><para>a pointer to a struct utimbuf.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-utime.returns" role="returns">
<title>Returns</title>
<para> 0 if the operation was successful, -1 if an error occurred</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.18">2.18</link></para></refsect2>
<refsect2 id="g-close" role="function" condition="since:2.36">
<title>g_close&#160;()</title>
<indexterm zone="g-close" role="2.36"><primary sortas="close">g_close</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_close (<parameter><link linkend="gint"><type>gint</type></link> fd</parameter>,
         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>This wraps the <link linkend="close"><function>close()</function></link> call; in case of error, <link linkend="errno"><literal>errno</literal></link> will be
preserved, but the error will also be stored as a <link linkend="GError"><type>GError</type></link> in <parameter>error</parameter>
.</para>
<para>Besides using <link linkend="GError"><type>GError</type></link>, there is another major reason to prefer this
function over the call provided by the system; on Unix, it will
attempt to correctly handle <link linkend="EINTR:CAPS"><literal>EINTR</literal></link>, which has platform-specific
semantics.</para>
<refsect3 id="g-close.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>fd</para></entry>
<entry role="parameter_description"><para>A file descriptor</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>a <link linkend="GError"><type>GError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-close.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> on success, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if there was an error.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.36">2.36</link></para></refsect2>

</refsect1>
<refsect1 id="glib-File-Utilities.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GFileError" role="enum">
<title>enum GFileError</title>
<indexterm zone="GFileError"><primary sortas="FileError">GFileError</primary></indexterm>
<para>Values corresponding to <parameter>errno</parameter>
 codes returned from file operations
on UNIX. Unlike <parameter>errno</parameter>
 codes, GFileError values are available on
all systems, even Windows. The exact meaning of each code depends
on what sort of file operation you were performing; the UNIX
documentation gives more details. The following error code descriptions
come from the GNU C Library manual, and are under the copyright
of that manual.</para>
<para>It's not very portable to make detailed assumptions about exactly
which errors will be returned from a given operation. Some errors
don't occur on some systems, etc., sometimes there are subtle
differences in when a system will report a given error, etc.</para>
<refsect3 id="GFileError.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-EXIST:CAPS">G_FILE_ERROR_EXIST</para></entry>
<entry role="enum_member_description"><para>Operation not permitted; only the owner of
the file (or other resource) or processes with special privileges
can perform the operation.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-ISDIR:CAPS">G_FILE_ERROR_ISDIR</para></entry>
<entry role="enum_member_description"><para>File is a directory; you cannot open a directory
for writing, or create or remove hard links to it.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-ACCES:CAPS">G_FILE_ERROR_ACCES</para></entry>
<entry role="enum_member_description"><para>Permission denied; the file permissions do not
allow the attempted operation.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NAMETOOLONG:CAPS">G_FILE_ERROR_NAMETOOLONG</para></entry>
<entry role="enum_member_description"><para>Filename too long.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NOENT:CAPS">G_FILE_ERROR_NOENT</para></entry>
<entry role="enum_member_description"><para>No such file or directory. This is a "file
doesn't exist" error for ordinary files that are referenced in
contexts where they are expected to already exist.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NOTDIR:CAPS">G_FILE_ERROR_NOTDIR</para></entry>
<entry role="enum_member_description"><para>A file that isn't a directory was specified when
a directory is required.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NXIO:CAPS">G_FILE_ERROR_NXIO</para></entry>
<entry role="enum_member_description"><para>No such device or address. The system tried to
use the device represented by a file you specified, and it
couldn't find the device. This can mean that the device file was
installed incorrectly, or that the physical device is missing or
not correctly attached to the computer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NODEV:CAPS">G_FILE_ERROR_NODEV</para></entry>
<entry role="enum_member_description"><para>The underlying file system of the specified file
does not support memory mapping.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-ROFS:CAPS">G_FILE_ERROR_ROFS</para></entry>
<entry role="enum_member_description"><para>The directory containing the new link can't be
modified because it's on a read-only file system.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-TXTBSY:CAPS">G_FILE_ERROR_TXTBSY</para></entry>
<entry role="enum_member_description"><para>Text file busy.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-FAULT:CAPS">G_FILE_ERROR_FAULT</para></entry>
<entry role="enum_member_description"><para>You passed in a pointer to bad memory.
(GLib won't reliably return this, don't pass in pointers to bad
memory.)</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-LOOP:CAPS">G_FILE_ERROR_LOOP</para></entry>
<entry role="enum_member_description"><para>Too many levels of symbolic links were encountered
in looking up a file name. This often indicates a cycle of symbolic
links.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NOSPC:CAPS">G_FILE_ERROR_NOSPC</para></entry>
<entry role="enum_member_description"><para>No space left on device; write operation on a
file failed because the disk is full.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NOMEM:CAPS">G_FILE_ERROR_NOMEM</para></entry>
<entry role="enum_member_description"><para>No memory available. The system cannot allocate
more virtual memory because its capacity is full.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-MFILE:CAPS">G_FILE_ERROR_MFILE</para></entry>
<entry role="enum_member_description"><para>The current process has too many files open and
can't open any more. Duplicate descriptors do count toward this
limit.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NFILE:CAPS">G_FILE_ERROR_NFILE</para></entry>
<entry role="enum_member_description"><para>There are too many distinct file openings in the
entire system.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-BADF:CAPS">G_FILE_ERROR_BADF</para></entry>
<entry role="enum_member_description"><para>Bad file descriptor; for example, I/O on a
descriptor that has been closed or reading from a descriptor open
only for writing (or vice versa).</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-INVAL:CAPS">G_FILE_ERROR_INVAL</para></entry>
<entry role="enum_member_description"><para>Invalid argument. This is used to indicate
various kinds of problems with passing the wrong argument to a
library function.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-PIPE:CAPS">G_FILE_ERROR_PIPE</para></entry>
<entry role="enum_member_description"><para>Broken pipe; there is no process reading from the
other end of a pipe. Every library function that returns this
error code also generates a 'SIGPIPE' signal; this signal
terminates the program if not handled or blocked. Thus, your
program will never actually see this code unless it has handled
or blocked 'SIGPIPE'.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-AGAIN:CAPS">G_FILE_ERROR_AGAIN</para></entry>
<entry role="enum_member_description"><para>Resource temporarily unavailable; the call might
work if you try again later.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-INTR:CAPS">G_FILE_ERROR_INTR</para></entry>
<entry role="enum_member_description"><para>Interrupted function call; an asynchronous signal
occurred and prevented completion of the call. When this
happens, you should try the call again.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-IO:CAPS">G_FILE_ERROR_IO</para></entry>
<entry role="enum_member_description"><para>Input/output error; usually used for physical read
or write errors. i.e. the disk or other physical device hardware
is returning errors.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-PERM:CAPS">G_FILE_ERROR_PERM</para></entry>
<entry role="enum_member_description"><para>Operation not permitted; only the owner of the
file (or other resource) or processes with special privileges can
perform the operation.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-NOSYS:CAPS">G_FILE_ERROR_NOSYS</para></entry>
<entry role="enum_member_description"><para>Function not implemented; this indicates that
the system is missing some functionality.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-ERROR-FAILED:CAPS">G_FILE_ERROR_FAILED</para></entry>
<entry role="enum_member_description"><para>Does not correspond to a UNIX error code; this
is the standard "failed for unspecified reason" error code present
in all <link linkend="GError"><type>GError</type></link> error code enumerations. Returned if no specific
code applies.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-FILE-ERROR:CAPS" role="macro">
<title>G_FILE_ERROR</title>
<indexterm zone="G-FILE-ERROR:CAPS"><primary sortas="FILE_ERROR">G_FILE_ERROR</primary></indexterm>
<programlisting language="C">#define G_FILE_ERROR g_file_error_quark ()
</programlisting>
<para>Error domain for file operations. Errors in this domain will
be from the <link linkend="GFileError"><type>GFileError</type></link> enumeration. See <link linkend="GError"><type>GError</type></link> for information
on error domains.</para>
</refsect2>
<refsect2 id="GFileTest" role="enum">
<title>enum GFileTest</title>
<indexterm zone="GFileTest"><primary sortas="FileTest">GFileTest</primary></indexterm>
<para>A test to perform on a file using <link linkend="g-file-test"><function>g_file_test()</function></link>.</para>
<refsect3 id="GFileTest.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-TEST-IS-REGULAR:CAPS">G_FILE_TEST_IS_REGULAR</para></entry>
<entry role="enum_member_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file is a regular file
(not a directory). Note that this test will also return <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>
if the tested file is a symlink to a regular file.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-TEST-IS-SYMLINK:CAPS">G_FILE_TEST_IS_SYMLINK</para></entry>
<entry role="enum_member_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file is a symlink.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-TEST-IS-DIR:CAPS">G_FILE_TEST_IS_DIR</para></entry>
<entry role="enum_member_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file is a directory.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-TEST-IS-EXECUTABLE:CAPS">G_FILE_TEST_IS_EXECUTABLE</para></entry>
<entry role="enum_member_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file is executable.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-FILE-TEST-EXISTS:CAPS">G_FILE_TEST_EXISTS</para></entry>
<entry role="enum_member_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file exists. It may or may not
be a regular file.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GDir" role="struct">
<title>GDir</title>
<indexterm zone="GDir"><primary sortas="Dir">GDir</primary></indexterm>
<programlisting language="C">typedef struct _GDir GDir;</programlisting>
<para>An opaque structure representing an opened directory.</para>
</refsect2>
<refsect2 id="GMappedFile" role="struct">
<title>GMappedFile</title>
<indexterm zone="GMappedFile"><primary sortas="MappedFile">GMappedFile</primary></indexterm>
<programlisting language="C">typedef struct _GMappedFile GMappedFile;</programlisting>
<para>The <link linkend="GMappedFile"><type>GMappedFile</type></link> represents a file mapping created with
<link linkend="g-mapped-file-new"><function>g_mapped_file_new()</function></link>. It has only private members and should
not be accessed directly.</para>
</refsect2>
<refsect2 id="GStatBuf" role="typedef">
<title>GStatBuf</title>
<indexterm zone="GStatBuf"><primary sortas="StatBuf">GStatBuf</primary></indexterm>
<programlisting language="C">typedef struct _stat32 GStatBuf;
</programlisting>
<para>A type corresponding to the appropriate struct type for the <link linkend="stat"><function>stat()</function></link>
system call, depending on the platform and/or compiler being used.</para>
<para>See <link linkend="g-stat"><function>g_stat()</function></link> for more information.</para>
</refsect2>

</refsect1>

</refentry>
